Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Linestyles for base contour of 3D plot

2,825 views
Skip to first unread message

Andreas Krause

unread,
Jun 15, 2007, 7:50:17 AM6/15/07
to
By following the advice from "help contour" and "index", I could define
my own linestyles for the *surface* contours of a 3D plot.

Is there a way to use the same user defined linestyles for the *base*
contours, plotted with "set contour base"?

andi

Ethan Merritt

unread,
Jun 15, 2007, 12:55:06 PM6/15/07
to
In article <f4tudp$s3l$1...@horus07.muc.infineon.com>,

Normally they *are* the same, so I am not sure what you did to make
them different. You may have found a bug, in which case please tell
us the version of gnuplot you are using and provide an example set
of commands that demonstrates the but.

The most complete way to redefine line styles in the current gnuplot
version (4.2) is to use the command
set style increment user

This tells the program to replace the auto-generated sequence of
line types with the corresponding sequence of user-defined line styles.
For example, normally if you say
plot f(x), g(x), h(x)
the three lines plotted will appear in linetype 1, linetype 2,
and linetype 3. By default this is red, green, blue for most terminals.
However if you define the following substitute line styles:

set style line 1 lc rgb "black" lw 2
set style line 2 lc rgb "gold" lw 1
set style line 3 lt 0 lc rgb "blue"
set style increment user

then that same plot command will result in a plot with a thick
black line, a thin gold line, and a dotted blue line.

--
Ethan A Merritt

Ingo Thies

unread,
Jun 18, 2007, 12:06:00 PM6/18/07
to
Ethan Merritt wrote:

> Normally they *are* the same, so I am not sure what you did to make
> them different. You may have found a bug, in which case please tell
> us the version of gnuplot you are using and provide an example set
> of commands that demonstrates the but.

I guess he means the fact(?) that one cannot change the linestyes of the
base contours. Any lt, lc etc. statement is ignored. As a workaround, I
normally edit the style directly in the postscript output since it is
very well formatted (I think even better in v4.2 than in 4.0).

> set style increment user

A, I did not know this statement before, thanks!

However, editing postscript may still be useful in some cases,
especially if you do not have the source data any more ;-)

Ingo

Hans-Bernhard Bröker

unread,
Jun 18, 2007, 6:25:36 PM6/18/07
to
Ingo Thies wrote:

> I guess he means the fact(?) that one cannot change the linestyes of the
> base contours.

Huh?

> Any lt, lc etc. statement is ignored.

Not in any edition of gnuplot I'm aware of. You will have to pay
attention to 'help set clabel', though.

Ingo Thies

unread,
Jun 19, 2007, 3:43:03 AM6/19/07
to
Hans-Bernhard Bröker wrote:

"The first contour linetype, or only contour linetype when clabel is
off, is the surface linetype +1; contour points are the same style as
surface points."

And this is exactly what Gnuplot does: You can vary the first linetype,
but not anything else. For example:
set xrange [-pi/2:pi/2]; set yrange [-pi/2:pi/2]
set style function lp
set contour
set isosamples 10,10; set samples 10,10;
splot cos(x)*cos(y) lc rgb "#007700"
set samples 4,10; replot
set samples 10,4; replot

sets only the grid color to dark green while the contour colors are the
defaults. However, even "set style increment user" only seems to affect
the first style and to shift the other styles by one, but does not
affect the other styles themselves.

Ingo

Andreas Krause

unread,
Jun 19, 2007, 4:47:27 PM6/19/07
to
Ethan Merritt wrote:

> Andreas Krause <spot...@gmx.de> wrote:
>> Is there a way to use the same user defined linestyles for the *base*
>> contours, plotted with "set contour base"?
>
> Normally they *are* the same, so I am not sure what you did to make
> them different. You may have found a bug, in which case please tell
> us the version of gnuplot you are using and provide an example set
> of commands that demonstrates the but.

Sorry for the delay. I currently use gnuplot 4.2 patchlevel rc2

My .Xresources file:

gnuplot*background: white
gnuplot*textColor: black
gnuplot*borderColor: black
gnuplot*axisColor: black
gnuplot*line1Color: black
gnuplot*line2Color: green
gnuplot*line3Color: red
gnuplot*line4Color: blue
gnuplot*line5Color: navy
gnuplot*line6Color: DarkGreen
gnuplot*line7Color: DarkRed
gnuplot*line8Color: coral

My gnuplot script:

set terminal x11
set timestamp
set title "Title"
set grid xtics ytics ztics
set xtics autofreq
set xlabel "X2"
set xrange [*:*]
set ylabel "X3"
set yrange [*:*]
set zlabel "X4"
set zrange [*:*]
set ytics autofreq
set ztics autofreq
set style line 1 lc rgb '#606060' lt 1 lw 1 pt 1 ps 1
set style line 2 lc rgb '#ffa000' lt 1 lw 2 pt 1 ps 1
set style line 3 lc rgb '#ff4030' lt 1 lw 2 pt 1 ps 1
set style line 4 lc rgb '#c00000' lt 1 lw 2 pt 1 ps 1
set style line 5 lc rgb '#800000' lt 1 lw 2 pt 1 ps 1
set style line 6 lc rgb '#8000ff' lt 1 lw 2 pt 1 ps 1
set style line 7 lc rgb '#2020ff' lt 1 lw 2 pt 1 ps 1
set style line 8 lc rgb '#400000' lt 1 lw 2 pt 1 ps 1
set style line 9 lc rgb '#008000' lt 1 lw 2 pt 1 ps 1
set style line 10 lc rgb '#00c000' lt 1 lw 2 pt 1 ps 1
set style line 11 lc rgb '#00ff00' lt 1 lw 2 pt 1 ps 1

# save the contour data to a file
set cntrparam levels 10
set contour both
set table '/tmp/showmesh/contour.data'
unset surface
splot "griddata" using 1:2:11 title "Graph" w l ls 1
unset table

unset contour # remark 1
# set style increment user # remark 2

# plot Graph and countour data from file
set surface
splot "griddata" using 1:2:11 title "Graph" w l ls 1 ,\
'/tmp/showmesh/contour.data' index 0 title '2.5' w l ls 2,\
'' index 1 title '2.0' w l ls 3,\
'' index 2 title '1.5' w l ls 4,\
'' index 3 title '1.0' w l ls 5,\
'' index 4 title '0.5' w l ls 6,\
'' index 5 title '0.0' w l ls 7,\
'' index 6 title '-0.5' w l ls 8,\
'' index 7 title '-1.0' w l ls 9,\
'' index 8 title '-1.5' w l ls 10,\
'' index 9 title '-2.0' w l ls 11
pause -1


I can send you the file "griddata" (175k) via PM if it is needed.

Run like above everything is fine: Contours on the 3D surface with my
defined linestyles.

When commenting out "unset contour" (remark 1), the "set contour both"
some lines above stay active and I get the same plot with additional
base contours. But the base contours don't have the defined linestyles
but the default ones (color, line type...). In addition I get 9 warnings
"Notice: cannot contour non grid data!".

Uncommenting "set style increment user" (remark 2) makes no difference
at all in the output.

Thanks for your patience

andi

Hans-Bernhard Bröker

unread,
Jun 19, 2007, 4:50:44 PM6/19/07
to
Ingo Thies wrote:
> However, even "set style increment user" only seems to affect
> the first style and to shift the other styles by one, but does not
> affect the other styles themselves.

It looks like this was forgotten in the implementation of 'set style
increment user'.

Ethan Merritt

unread,
Jun 20, 2007, 5:34:42 PM6/20/07
to
In article <f59fiq$lt7$00$1...@news.t-online.com>,

Yes, you are right.
The auto-increment within the loop over contours was overlooked.
The same may be true for some histogram modes.
Expect a fix in CVS at some point.
I think the fix will be trivial enough for inclusion in 4.2.1
--
Ethan A Merritt

0 new messages