Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?J=c3=b6rg_Buchholz?= Newsgroups: comp.graphics.apps.gnuplot Subject: Re: auto caluclation for data display Date: Thu, 18 Jun 2015 21:40:05 +0200 Organization: A noiseless patient Spider Lines: 39 Message-ID: References: <94ad6511-e08e-4e88-87b3-df6b6f6ff876@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 18 Jun 2015 19:38:47 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="af56dab264ad7f104c9ab3523ed63ddb"; logging-data="6703"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Kmb8Bu1CX0UEae+XSwjSSm1H/GMpuI0s=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 SeaMonkey/2.33.1 In-Reply-To: <94ad6511-e08e-4e88-87b3-df6b6f6ff876@googlegroups.com> Cancel-Lock: sha1:sU6lQsvDAkDdXTV/PpG9z6Ubwvo= Xref: csiph.com comp.graphics.apps.gnuplot:2944 On 18.06.2015 14:01, Syed Jahanzaib wrote: > greetings all, > > I am graphing downloads for the user account, but issue is the divide > forumla. Is there any method in which gnuplot can auto measure the > data like if its in KB , it should it in KB, if its in MB, it should > show MB, if its in GB it should GB or vise verse for TB. Do you want it for ploting labels at the bars or as ylabel? I think there is only one ylabel for one graph. > at a moment I am dividing the formula like /1024/1024 to get data in > GB which have issue that if data is less then GB, it shows 0.xxx If you need to scale the whole yaxis you can first use the stats command to get the maximum of your data. stats "data.txt" u 1:2 max_y = STATS_max_y This give you the maximum of column 2 into the variable "max_y" Than you can work with "if" and "else". if max_y > a than set ylabel 'GB' plot "data.txt" u 1:($2/1024/1024) else{If max_y > b than set ylabel 'MB' plot "data.txt" u 1:($2/1024) else set ylabel 'KB' plot "data.txt" u 1:2} This not the real code for gnuplot, it is only a way to do something like you want. For including TB, you need a 4 step "if/else" argument. Jörg