<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent posts to GNUPLOT : automatic position and size</title><link>https://sourceforge.net/p/gnuplot/discussion/5924/thread/889ab2d2ed/</link><description>Recent posts to GNUPLOT : automatic position and size</description><atom:link href="https://sourceforge.net/p/gnuplot/discussion/5924/thread/889ab2d2ed/feed.rss" rel="self"/><language>en</language><lastBuildDate>Mon, 13 May 2019 11:59:16 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/gnuplot/discussion/5924/thread/889ab2d2ed/feed.rss" rel="self" type="application/rss+xml"/><item><title>GNUPLOT : automatic position and size</title><link>https://sourceforge.net/p/gnuplot/discussion/5924/thread/889ab2d2ed/?limit=25#db62</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have developped a CGI in bash/html that allow me to generate a graph of my clusters.&lt;/p&gt;
&lt;p&gt;Here is an exemple : &lt;/p&gt;
&lt;p&gt;&lt;img alt="" rel="nofollow" src="https://i.stack.imgur.com/FUv0i.png"/&gt;&lt;/p&gt;
&lt;p&gt;This is a graph that works well. The problem is that for some graphs, the percentages overlap or shift far too far from where it should be. Here is my GNUPLOT code &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;f(w) = (strlen(w) &amp;gt; 10 ? word(w, 1) . "\n" . word(w, 2) : w)

set title "TITLE"
set terminal png truecolor size 960, 720 background rgb "#eff1f0"
set output "/var/www/html/CLUSTER_NAME.png"
set bmargin at screen 0.1
set key top center
set grid
set style data histograms
set style fill solid 1.00 border -1
set boxwidth 0.7 relative
set yrange [*:*]
set format y "%g%%"
set datafile separator ","
plot 'test1.txt' using 2:xtic(f(stringcolumn(1))) title " CPU consumption (%) ", \
'' using 3 title " RAM consumption (%)", \
'' using 0:($2+1):(sprintf(" %g%%",$2)) with labels notitle, \
'' using 0:($3+1):(sprintf("     %g%%",$3)) with labels notitle
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Here is an example of a graph that does not work properly because the percentages are too shifted :&lt;/p&gt;
&lt;p&gt;&lt;img alt="" rel="nofollow" src="https://i.stack.imgur.com/RdCz6.png"/&gt;&lt;/p&gt;
&lt;p&gt;I am able to change this by changing this line in my code:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;'' using 0:($3+1):(sprintf(" %g%%",$3)) with labels notitle
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;To : &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;'' using 0:($3+1):(sprintf("                               %g%%",$3)) with labels notitle
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Adding spaces allows to shift the percentages :&lt;/p&gt;
&lt;p&gt;&lt;img alt="" rel="nofollow" src="https://i.stack.imgur.com/h1z51.png"/&gt;&lt;/p&gt;
&lt;p&gt;But even if it works for this graph, it moves the percentages for the other graphs too... :&lt;/p&gt;
&lt;p&gt;&lt;img alt="" rel="nofollow" src="https://i.stack.imgur.com/11DWt.png"/&gt;&lt;/p&gt;
&lt;p&gt;I can't get "clean" graphics. Either the percentages overlap, or they go out of scope because the values are too large, or they are completely shifted....&lt;/p&gt;
&lt;p&gt;Another example:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" rel="nofollow" src="https://i.stack.imgur.com/jpker.png"/&gt;&lt;/p&gt;
&lt;p&gt;Is there a way to make all this move by itself, automatically, according to the values and therefore the size of the bars etc?&lt;/p&gt;
&lt;p&gt;Thanks ! :)&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ezzmazz</dc:creator><pubDate>Mon, 13 May 2019 11:59:16 -0000</pubDate><guid>https://sourceforge.net0eea2739e6e4c571d59944d9fb3c6a9cc58f5d3c</guid></item></channel></rss>