|
From: Brynolf <pat...@gm...> - 2013-10-12 13:36:55
|
Hello, I want to use smoothing with the filledcurves plot, but I am unable to do so. When I add smooth csplines to the command it will only consider the first two columns and disregard the third column and plot a line, not two lines with filled center, so to speak. Any help appreciated! My code: set terminal pngcairo set output 'plotData.png' set style fill transparent solid .1 noborder plot "data.dat" using 1:2 title "avg" smooth csplines lc rgbcolor "blue",\ "" using 1:($2-sqrt($3)) notitle smooth csplines lc rgbcolor "blue",\ "" using 1:($2+sqrt($3)) notitle smooth csplines lc rgbcolor "blue",\ "" using 1:4 title "mag" smooth csplines ls 1 lc rgbcolor "red",\ "" using 1:($4-sqrt($5)):($4+sqrt($5)) w filledcu notitle smooth csplines lc rgbcolor "black" with data.dat containing: 30 0.062091 0.00055934 0.062135 0.00060258 35 1.5811 0.0011609 1.4886 0.34498 40 5.7981 0.0022667 5.466 4.768 45 2.9185 0.0014332 2.7366 1.1653 50 1.0325 0.0027071 0.97853 0.14908 55 0.95136 0.0030296 0.90318 0.12694 60 1.1746 0.0022948 1.1095 0.19144 65 1.1357 0.0024049 1.0738 0.17953 100 0.81919 0.0037934 0.78151 0.095113 125 0.76154 0.0040944 0.72843 0.082592 150 0.70832 0.0044431 0.67914 0.071776 -- View this message in context: http://gnuplot.10905.n7.nabble.com/Smooth-with-filledcurves-tp17726.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Ethan A M. <EAM...@gm...> - 2013-10-12 18:06:16
|
On Saturday, 12 October 2013 06:36:47 AM Brynolf wrote:
> Hello,
>
> I want to use smoothing with the filledcurves plot, but I am unable to do
> so. When I add smooth csplines to the command it will only consider the
> first two columns and disregard the third column and plot a line, not two
> lines with filled center, so to speak. Any help appreciated
Consider only the part of the command you ask about:
> plot 'data.dat' using 1:($4-sqrt($5)):($4+sqrt($5)) w filledcu notitle smooth csplines
There are 2 or 3 problems here.
One is fairly simple:
The "smooth csplines" must come immediately after the "using ...." part
of the command. So you would need to move the "with filledcurve" to the end:
? plot 'data.dat' using 1:($4-sqrt($5)):($4+sqrt($5)) smooth csplines w filledcu
However a bigger problem is that the "smooth" operation _replaces_ your
original data with a new curve defined by only an x value from the first
"using" column and a smoothed y value from the second "using" column.
The third "using" column is ignored, and no longer exists after the smoothing
operation. This confuses the "with filledcurves" command, so we'll call it
a bug that the program does not issue some error or warning message.
If you remove the third "using" column, you'll see better what is happening:
? plot 'data.dat' using 1:($4-sqrt($5)) smooth csplines w filledcu
That command does give you a filled curve from the smoothed data,
but of course it's not quite the curve you wanted.
Possibly this two-part solution is acceptable:
plot "data.dat" using 1:($4+sqrt($5)) smooth csplines w filledcu lc rgb "black", \
"" using 1:($4-sqrt($5)) smooth csplines w filledcu lc rgb "white"
That wouldn't quite work in the general case, but it works in your case because
we know that y-sqrt(foo) is always less than y+sqrt(foo) so the second curve
is strictly less or equal to the first curve.
Ethan
> ! My code:
>
> set terminal pngcairo
> set output 'plotData.png'
> set style fill transparent solid .1 noborder
>
> plot "data.dat" using 1:2 title "avg" smooth csplines lc rgbcolor "blue",\
> "" using 1:($2-sqrt($3)) notitle smooth csplines lc rgbcolor "blue",\
> "" using 1:($2+sqrt($3)) notitle smooth csplines lc rgbcolor "blue",\
> "" using 1:4 title "mag" smooth csplines ls 1 lc rgbcolor "red",\
> "" using 1:($4-sqrt($5)):($4+sqrt($5)) w filledcu notitle smooth csplines
> lc rgbcolor "black"
>
> with data.dat containing:
> 30 0.062091 0.00055934 0.062135 0.00060258
> 35 1.5811 0.0011609 1.4886 0.34498
> 40 5.7981 0.0022667 5.466 4.768
> 45 2.9185 0.0014332 2.7366 1.1653
> 50 1.0325 0.0027071 0.97853 0.14908
> 55 0.95136 0.0030296 0.90318 0.12694
> 60 1.1746 0.0022948 1.1095 0.19144
> 65 1.1357 0.0024049 1.0738 0.17953
> 100 0.81919 0.0037934 0.78151 0.095113
> 125 0.76154 0.0040944 0.72843 0.082592
> 150 0.70832 0.0044431 0.67914 0.071776
>
>
>
> --
> View this message in context: http://gnuplot.10905.n7.nabble.com/Smooth-with-filledcurves-tp17726.html
> Sent from the Gnuplot - User mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
> _______________________________________________
> gnuplot-info mailing list
> gnu...@li...
> Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
|