|
From: somesh <som...@gm...> - 2013-01-24 15:46:52
|
Hi, I have a data file like this: #x y 1 34 2 450 3 -987 4 20045 5 -1003 6 -30 For only positive values, just "logscale y" is fine. For only negative values, I can use a reversed logscale: -- set logscale y set yrange [ymin:ymax] reverse plot file u 1:(-$2) axis x1y1 t "Y" w linespoints -- But how do I plot both positive and negative values in same plot? I want to place the x axis at the center of y axis; positive log scale (for positive values) above the x axis, and reversed logscale (for negative values) below the x axis. Is it possible? Thanks, Somesh -- View this message in context: http://gnuplot.10905.n7.nabble.com/Both-positive-and-negative-log-y-axis-in-same-plot-tp17082.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: <l_b...@us...> - 2013-01-24 16:34:08
|
>From mailnull Thu Jan 24 15:48:29 2013 Received-SPF: neutral (sog-mx-4.v43.ch3.sourceforge.com: 172.29.29.180 is neither permitted nor denied by domain of lists.sourceforge.net) client-ip=172.29.29.180; env...@li...; helo=lists.sourceforge.net; Received-SPF: neutral (sog-mx-3.v43.ch3.sourceforge.com: 216.139.250.139 is neither permitted nor denied by domain of gmail.com) client-ip=216.139.250.139; env...@gm...; helo=joe.nabble.com; Date: Thu, 24 Jan 2013 07:46:43 -0800 From: somesh <som...@gm...> Content-Type: text/plain; charset="us-ascii" Hi, I have a data file like this: #x y 1 34 2 450 3 -987 4 20045 5 -1003 6 -30 For only positive values, just "logscale y" is fine. For only negative values, I can use a reversed logscale: -- set logscale y set yrange [ymin:ymax] reverse plot file u 1:(-$2) axis x1y1 t "Y" w linespoints -- But how do I plot both positive and negative values in same plot? I want to place the x axis at the center of y axis; positive log scale (for positive values) above the x axis, and reversed logscale (for negative values) below the x axis. How about f(x) = (x >= 0 ? x : 1/abs(x)); plot file using 1:(f($2)) .... Leo |
|
From: BBands <bb...@gm...> - 2013-01-24 16:40:52
|
That sort of approach is often useful in plotting certain types of
technical analysis indicators. One way I have seen that done is to
pick a pair arbitrary cutoff points near zero. You could try Googling
for John McGinley. He wrote on the subject back in the 1980s. His
solution was to plot a small slice of the chart just above and below
zero with a linear scale. I add a hatch to the region to make the
discontinuity clear. I haven't tried this in gnuplot, but Ethan
Merritt demoed some tricks using the ternary operator that should make
it doable.
John Bollinger
On Thu, Jan 24, 2013 at 7:46 AM, somesh <som...@gm...> wrote:
> Hi,
>
> I have a data file like this:
> #x y
> 1 34
> 2 450
> 3 -987
> 4 20045
> 5 -1003
> 6 -30
>
> For only positive values, just "logscale y" is fine.
> For only negative values, I can use a reversed logscale:
> --
> set logscale y
> set yrange [ymin:ymax] reverse
> plot file u 1:(-$2) axis x1y1 t "Y" w linespoints
> --
>
> But how do I plot both positive and negative values in same plot?
> I want to place the x axis at the center of y axis; positive log scale (for
> positive values) above the x axis, and reversed logscale (for negative
> values) below the x axis.
>
> Is it possible?
>
> Thanks,
> Somesh
>
>
>
> --
> View this message in context: http://gnuplot.10905.n7.nabble.com/Both-positive-and-negative-log-y-axis-in-same-plot-tp17082.html
> Sent from the Gnuplot - User mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> _______________________________________________
> gnuplot-info mailing list
> gnu...@li...
> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
--
John Bollinger
www.BollingerBands.com
|
|
From: somesh <som...@gm...> - 2013-01-25 00:00:35
|
Leo Butler wrote > How about > > f(x) = (x >= 0 ? x : 1/abs(x)); > > plot file using 1:(f($2)) .... > > > Leo BBands wrote > That sort of approach is often useful in plotting certain types of > technical analysis indicators. One way I have seen that done is to > pick a pair arbitrary cutoff points near zero. You could try Googling > for John McGinley. He wrote on the subject back in the 1980s. His > solution was to plot a small slice of the chart just above and below > zero with a linear scale. I add a hatch to the region to make the > discontinuity clear. I haven't tried this in gnuplot, but Ethan > Merritt demoed some tricks using the ternary operator that should make > it doable. > > John Bollinger Thanks Leo and John for the ideas! I could do something similar to what I wanted by this: f(x) = (x >= 0 ? log10(x) : log10(1/abs(x))); then combine the following two plots (in linear scale) using multiplot ... set yrange [0:4] plot file using 1:(f($2)) set yrange [-4:0] plot file using 1:(f($2)) The use of multiplot is to place two plots above and below the zero line. Positioning is tricky but doable! Thanks, Somesh -- View this message in context: http://gnuplot.10905.n7.nabble.com/Both-positive-and-negative-log-y-axis-in-same-plot-tp17082p17085.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |