Quantcast

gnuplot and dashed lines

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

gnuplot and dashed lines

CdeMills
Hello,

I was struggling to obtain dashed lines without success. At first I believe it was MacOs specific; now I've found the problem.

If you take the content of http://gnuplot.sourceforge.net/demo/dashcolor.html
and paste it into gnuplot interface, you get the same figure as given on the web page. If you download the script provided at http://gnuplot.sourceforge.net/demo/dashcolor.1.gnu which is supposed to give exactly the same result, you don't.

There is a subtle difference: the script does not include the 'set termoption dashed' command at the beginning. This makes a lot of differences: by default, it seems that gnuplot renders all lines as solid.

To verify, it tried this simple script:
 x = 1:10;
 h=plot (x,x,'-;line 1;',x,x+1,'--;line 2;')

I got a figure with two continuous lines. Then I did
drawnow("aqua", "/dev/null", false, "debug.gp")
edited the debug.gp file, added a "set term option dashed" at the beginning, then, in a terminal:
gnuplot < debug.gp

and got the dashed lines ! The missing point is thus to add this "termoption" at the beginning of the gnuplot script. Another option is to create a "~/.gnuplot" with this line:
set termoption dashed

Restarted Octave, ran the same script, and got a dashed line directly! Dash-dot working too.

This should be either corrected into the gnuplot interface, either documented. Moreover, gnuplot seems to not have a way to query the termoption settings. I don't see how to interactively test wether or not this feature is supported.

Regards

Pascal

 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gnuplot and dashed lines

bpabbott
Administrator
On Dec 20, 2012, at 10:46 AM, CdeMills wrote:

> Hello,
>
> I was struggling to obtain dashed lines without success. At first I believe
> it was MacOs specific; now I've found the problem.
>
> If you take the content of
> http://gnuplot.sourceforge.net/demo/dashcolor.html
> and paste it into gnuplot interface, you get the same figure as given on the
> web page. If you download the script provided at
> http://gnuplot.sourceforge.net/demo/dashcolor.1.gnu which is supposed to
> give exactly the same result, you don't.
>
> There is a subtle difference: the script does not include the 'set
> termoption dashed' command at the beginning. This makes a lot of
> differences: by default, it seems that gnuplot renders all lines as solid.
>
> To verify, it tried this simple script:
> x = 1:10;
> h=plot (x,x,'-;line 1;',x,x+1,'--;line 2;')
>
> I got a figure with two continuous lines. Then I did
> drawnow("aqua", "/dev/null", false, "debug.gp")
> edited the debug.gp file, added a "set term option dashed" at the beginning,
> then, in a terminal:
> gnuplot < debug.gp
>
> and got the dashed lines ! The missing point is thus to add this
> "termoption" at the beginning of the gnuplot script. Another option is to
> create a "~/.gnuplot" with this line:
> set termoption dashed
>
> Restarted Octave, ran the same script, and got a dashed line directly!
> Dash-dot working too.
>
> This should be either corrected into the gnuplot interface, either
> documented. Moreover, gnuplot seems to not have a way to query the
> termoption settings. I don't see how to interactively test wether or not
> this feature is supported.
>
> Regards
>
> Pascal

If you are intetested in making a changeset, the place for this change is in __gnuplot_drawnow__.m, or in __go_draw_figure__.m

Ben


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gnuplot and dashed lines

bpabbott
Administrator

On Dec 20, 2012, at 10:55 AM, Ben Abbott wrote:

> On Dec 20, 2012, at 10:46 AM, CdeMills wrote:
>
>> Hello,
>>
>> I was struggling to obtain dashed lines without success. At first I believe
>> it was MacOs specific; now I've found the problem.
>>
>> If you take the content of
>> http://gnuplot.sourceforge.net/demo/dashcolor.html
>> and paste it into gnuplot interface, you get the same figure as given on the
>> web page. If you download the script provided at
>> http://gnuplot.sourceforge.net/demo/dashcolor.1.gnu which is supposed to
>> give exactly the same result, you don't.
>>
>> There is a subtle difference: the script does not include the 'set
>> termoption dashed' command at the beginning. This makes a lot of
>> differences: by default, it seems that gnuplot renders all lines as solid.
>>
>> To verify, it tried this simple script:
>> x = 1:10;
>> h=plot (x,x,'-;line 1;',x,x+1,'--;line 2;')
>>
>> I got a figure with two continuous lines. Then I did
>> drawnow("aqua", "/dev/null", false, "debug.gp")
>> edited the debug.gp file, added a "set term option dashed" at the beginning,
>> then, in a terminal:
>> gnuplot < debug.gp
>>
>> and got the dashed lines ! The missing point is thus to add this
>> "termoption" at the beginning of the gnuplot script. Another option is to
>> create a "~/.gnuplot" with this line:
>> set termoption dashed
>>
>> Restarted Octave, ran the same script, and got a dashed line directly!
>> Dash-dot working too.
>>
>> This should be either corrected into the gnuplot interface, either
>> documented. Moreover, gnuplot seems to not have a way to query the
>> termoption settings. I don't see how to interactively test wether or not
>> this feature is supported.
>>
>> Regards
>>
>> Pascal
>
> If you are intetested in making a changeset, the place for this change is in __gnuplot_drawnow__.m, or in __go_draw_figure__.m
>
> Ben

I'm not sure if the "dashed" option can be used in all terminals, but I tried the change below.

diff --git a/scripts/plot/__gnuplot_drawnow__.m b/scripts/plot/__gnuplot_drawnow__.m
--- a/scripts/plot/__gnuplot_drawnow__.m
+++ b/scripts/plot/__gnuplot_drawnow__.m
@@ -321,6 +321,14 @@
         endif
       endif
     endif
+    dashed_terms = {"aqua", "cairolatex", "canvas", "cgm", "context", ...
+                    "eepic", "emf", "epslatex", "fig", "pcl5", "tikz", ...
+                    "mp", "next", "openstep", "pdf", "pdfcairo", ...
+                    "pngcairo", "postscript", "pslatex", "pstex", ...
+                    "svg", "tgif", "windows", "wxt", "x11"};
+    if (any (strncmp (term, dashed_terms, numel (term))))
+      fprintf (plot_stream, "set termoption dashed\n")
+    endif
   else
     ## gnuplot will pick up the GNUTERM environment variable itself
     ## so no need to set the terminal type if not also setting the

"aqua" produced a dashed line, but neither qt (no "dashed" option) or x11 did.

Apparently more work will be needed to support the linestyles for x11.

Ben

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gnuplot and dashed lines

Daniel Sebald
On 12/20/2012 07:39 PM, Ben Abbott wrote:

>
> On Dec 20, 2012, at 10:55 AM, Ben Abbott wrote:
>
>> On Dec 20, 2012, at 10:46 AM, CdeMills wrote:
>>
>>> Hello,
>>>
>>> I was struggling to obtain dashed lines without success. At first I believe
>>> it was MacOs specific; now I've found the problem.
>>>
>>> If you take the content of
>>> http://gnuplot.sourceforge.net/demo/dashcolor.html
>>> and paste it into gnuplot interface, you get the same figure as given on the
>>> web page. If you download the script provided at
>>> http://gnuplot.sourceforge.net/demo/dashcolor.1.gnu which is supposed to
>>> give exactly the same result, you don't.
>>>
>>> There is a subtle difference: the script does not include the 'set
>>> termoption dashed' command at the beginning. This makes a lot of
>>> differences: by default, it seems that gnuplot renders all lines as solid.
>>>
>>> To verify, it tried this simple script:
>>> x = 1:10;
>>> h=plot (x,x,'-;line 1;',x,x+1,'--;line 2;')
>>>
>>> I got a figure with two continuous lines. Then I did
>>> drawnow("aqua", "/dev/null", false, "debug.gp")
>>> edited the debug.gp file, added a "set term option dashed" at the beginning,
>>> then, in a terminal:
>>> gnuplot<  debug.gp
>>>
>>> and got the dashed lines ! The missing point is thus to add this
>>> "termoption" at the beginning of the gnuplot script. Another option is to
>>> create a "~/.gnuplot" with this line:
>>> set termoption dashed
>>>
>>> Restarted Octave, ran the same script, and got a dashed line directly!
>>> Dash-dot working too.
>>>
>>> This should be either corrected into the gnuplot interface, either
>>> documented. Moreover, gnuplot seems to not have a way to query the
>>> termoption settings. I don't see how to interactively test wether or not
>>> this feature is supported.
>>>
>>> Regards
>>>
>>> Pascal
>>
>> If you are intetested in making a changeset, the place for this change is in __gnuplot_drawnow__.m, or in __go_draw_figure__.m
>>
>> Ben
>
> I'm not sure if the "dashed" option can be used in all terminals, but I tried the change below.

Generally no, but now days the most used of the terminals should
supported dashed lines.  In gnuplot that dashed-line-support quirk is a
bit of a throwback.

It's odd though that this should just surface now without others
noticing a fairly common feature missing from plotting in Octave.  I'm
going to check with the gnuplot list on this.


> diff --git a/scripts/plot/__gnuplot_drawnow__.m b/scripts/plot/__gnuplot_drawnow__.m
> --- a/scripts/plot/__gnuplot_drawnow__.m
> +++ b/scripts/plot/__gnuplot_drawnow__.m
> @@ -321,6 +321,14 @@
>           endif
>         endif
>       endif
> +    dashed_terms = {"aqua", "cairolatex", "canvas", "cgm", "context", ...
> +                    "eepic", "emf", "epslatex", "fig", "pcl5", "tikz", ...
> +                    "mp", "next", "openstep", "pdf", "pdfcairo", ...
> +                    "pngcairo", "postscript", "pslatex", "pstex", ...
> +                    "svg", "tgif", "windows", "wxt", "x11"};
> +    if (any (strncmp (term, dashed_terms, numel (term))))
> +      fprintf (plot_stream, "set termoption dashed\n")
> +    endif
>     else
>       ## gnuplot will pick up the GNUTERM environment variable itself
>       ## so no need to set the terminal type if not also setting the
>
> "aqua" produced a dashed line, but neither qt (no "dashed" option) or x11 did.

I've tried a rather recent version of gnuplot here.  Qt terminal seems
to support dashed lines (introduced on 2011-12-14), but not X11.  Try:

gnuplot> set term qt
Terminal type set to 'qt'
Options are '0'
gnuplot> test
[no dashed lines in the right column]
gnuplot> set termoptions dashed
gnuplot> test
[dashed lines in right column]
gnuplot> set term x11
Terminal type set to 'x11'
Options are ' nopersist'
gnuplot> test
[no dashed lines]
gnuplot> set term x11 dashed
Terminal type set to 'x11'
Options are ' nopersist dashed'
gnuplot> test
[no dashed lines...doesn't seem right]
gnuplot> set termoptions dashed
gnuplot> test
[no dashed lines...expected give previous result]

The dashed terminal test might not be necessary.  I think (but not sure)
that the "set termoption <opt>" is supposed to be a universal type of
setting and terminals are supposed to check that.


> Apparently more work will be needed to support the linestyles for x11.

I will look into this.  I just tried the latest gnuplot and the "test"
plot is a mess in X11.

Dan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gnuplot and dashed lines

bpabbott
Administrator

On Dec 20, 2012, at 9:19 PM, Daniel J Sebald wrote:

> On 12/20/2012 07:39 PM, Ben Abbott wrote:
>>
>> On Dec 20, 2012, at 10:55 AM, Ben Abbott wrote:
>>
>>> On Dec 20, 2012, at 10:46 AM, CdeMills wrote:
>>>
>>>> Hello,
>>>>
>>>> I was struggling to obtain dashed lines without success. At first I believe
>>>> it was MacOs specific; now I've found the problem.
>>>>
>>>> If you take the content of
>>>> http://gnuplot.sourceforge.net/demo/dashcolor.html
>>>> and paste it into gnuplot interface, you get the same figure as given on the
>>>> web page. If you download the script provided at
>>>> http://gnuplot.sourceforge.net/demo/dashcolor.1.gnu which is supposed to
>>>> give exactly the same result, you don't.
>>>>
>>>> There is a subtle difference: the script does not include the 'set
>>>> termoption dashed' command at the beginning. This makes a lot of
>>>> differences: by default, it seems that gnuplot renders all lines as solid.
>>>>
>>>> To verify, it tried this simple script:
>>>> x = 1:10;
>>>> h=plot (x,x,'-;line 1;',x,x+1,'--;line 2;')
>>>>
>>>> I got a figure with two continuous lines. Then I did
>>>> drawnow("aqua", "/dev/null", false, "debug.gp")
>>>> edited the debug.gp file, added a "set term option dashed" at the beginning,
>>>> then, in a terminal:
>>>> gnuplot<  debug.gp
>>>>
>>>> and got the dashed lines ! The missing point is thus to add this
>>>> "termoption" at the beginning of the gnuplot script. Another option is to
>>>> create a "~/.gnuplot" with this line:
>>>> set termoption dashed
>>>>
>>>> Restarted Octave, ran the same script, and got a dashed line directly!
>>>> Dash-dot working too.
>>>>
>>>> This should be either corrected into the gnuplot interface, either
>>>> documented. Moreover, gnuplot seems to not have a way to query the
>>>> termoption settings. I don't see how to interactively test wether or not
>>>> this feature is supported.
>>>>
>>>> Regards
>>>>
>>>> Pascal
>>>
>>> If you are intetested in making a changeset, the place for this change is in __gnuplot_drawnow__.m, or in __go_draw_figure__.m
>>>
>>> Ben
>>
>> I'm not sure if the "dashed" option can be used in all terminals, but I tried the change below.
>
> Generally no, but now days the most used of the terminals should supported dashed lines.  In gnuplot that dashed-line-support quirk is a bit of a throwback.
>
> It's odd though that this should just surface now without others noticing a fairly common feature missing from plotting in Octave.  I'm going to check with the gnuplot list on this.
>
>
>> diff --git a/scripts/plot/__gnuplot_drawnow__.m b/scripts/plot/__gnuplot_drawnow__.m
>> --- a/scripts/plot/__gnuplot_drawnow__.m
>> +++ b/scripts/plot/__gnuplot_drawnow__.m
>> @@ -321,6 +321,14 @@
>>          endif
>>        endif
>>      endif
>> +    dashed_terms = {"aqua", "cairolatex", "canvas", "cgm", "context", ...
>> +                    "eepic", "emf", "epslatex", "fig", "pcl5", "tikz", ...
>> +                    "mp", "next", "openstep", "pdf", "pdfcairo", ...
>> +                    "pngcairo", "postscript", "pslatex", "pstex", ...
>> +                    "svg", "tgif", "windows", "wxt", "x11"};
>> +    if (any (strncmp (term, dashed_terms, numel (term))))
>> +      fprintf (plot_stream, "set termoption dashed\n")
>> +    endif
>>    else
>>      ## gnuplot will pick up the GNUTERM environment variable itself
>>      ## so no need to set the terminal type if not also setting the
>>
>> "aqua" produced a dashed line, but neither qt (no "dashed" option) or x11 did.
>
> I've tried a rather recent version of gnuplot here.  Qt terminal seems to support dashed lines (introduced on 2011-12-14), but not X11.  Try:
>
> gnuplot> set term qt
> Terminal type set to 'qt'
> Options are '0'
> gnuplot> test
> [no dashed lines in the right column]
> gnuplot> set termoptions dashed
> gnuplot> test
> [dashed lines in right column]
> gnuplot> set term x11
> Terminal type set to 'x11'
> Options are ' nopersist'
> gnuplot> test
> [no dashed lines]
> gnuplot> set term x11 dashed
> Terminal type set to 'x11'
> Options are ' nopersist dashed'
> gnuplot> test
> [no dashed lines...doesn't seem right]
> gnuplot> set termoptions dashed
> gnuplot> test
> [no dashed lines...expected give previous result]
>
> The dashed terminal test might not be necessary.  I think (but not sure) that the "set termoption <opt>" is supposed to be a universal type of setting and terminals are supposed to check that.
>
>> Apparently more work will be needed to support the linestyles for x11.
>
> I will look into this.  I just tried the latest gnuplot and the "test" plot is a mess in X11.
>
> Dan

My gnuplot is

        gnuplot 4.6 patchlevel 1

Looking at sourceforge, I think this is the most recent version?  The manual for 4.6 has the syntax below for 'set term qt ..."

set term qt {<n>}

                   {size <width>,<height>}
                   {{no}enhanced}
                   {font <font>}
                   {title "title"}
                   {{no}persist}
                   {{no}raise}
                   {{no}ctrl}
                   {close}
                   {widget <id>}

Even though there is no "dashed" mentioned, I do see dashed lines in the "test" plot.  hmmm ... perhaps I the check that a term supports "dashed" should be skipped?

diff --git a/scripts/plot/__gnuplot_drawnow__.m b/scripts/plot/__gnuplot_drawnow__.m
--- a/scripts/plot/__gnuplot_drawnow__.m
+++ b/scripts/plot/__gnuplot_drawnow__.m
@@ -321,6 +321,7 @@
         endif
       endif
     endif
+    fprintf (plot_stream, "set termoption dashed\n")
   else
     ## gnuplot will pick up the GNUTERM environment variable itself
     ## so no need to set the terminal type if not also setting the

Unfortunately, when I use this change, I still don't get dashed lines from Octave when using the "qt" terminal.

Also, I looked at the "test" plots for x11. I don't see any dashed lines there.

Ben

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gnuplot and dashed lines

Daniel Sebald
On 12/20/2012 08:51 PM, Ben Abbott wrote:
>
> On Dec 20, 2012, at 9:19 PM, Daniel J Sebald wrote:
>
[snip]

> My gnuplot is
>
> gnuplot 4.6 patchlevel 1
>
> Looking at sourceforge, I think this is the most recent version?  The manual for 4.6 has the syntax below for 'set term qt ..."
>
> set term qt {<n>}
>
>                     {size<width>,<height>}
>                     {{no}enhanced}
>                     {font<font>}
>                     {title "title"}
>                     {{no}persist}
>                     {{no}raise}
>                     {{no}ctrl}
>                     {close}
>                     {widget<id>}
>
> Even though there is no "dashed" mentioned, I do see dashed lines in the "test" plot.

I'm using development version 4.7 and see no "dashed" in the
documentation either.  I will investigate, thanks.


>   hmmm ... perhaps I the check that a term supports "dashed" should be
skipped?

Yes, I think the unconditioned command should be fine.

>
> diff --git a/scripts/plot/__gnuplot_drawnow__.m b/scripts/plot/__gnuplot_drawnow__.m
> --- a/scripts/plot/__gnuplot_drawnow__.m
> +++ b/scripts/plot/__gnuplot_drawnow__.m
> @@ -321,6 +321,7 @@
>           endif
>         endif
>       endif
> +    fprintf (plot_stream, "set termoption dashed\n")
>     else
>       ## gnuplot will pick up the GNUTERM environment variable itself
>       ## so no need to set the terminal type if not also setting the
>
> Unfortunately, when I use this change, I still don't get dashed lines from Octave when using the "qt" terminal.

OK.  Maybe there is a variable overlooked because "qt" is a new terminal
and it does require "--enable-qt" when configuring.  I'll follow up with
the gnuplot list.  Thanks.


> Also, I looked at the "test" plots for x11. I don't see any dashed lines there.

I sent the list a note and I've isolated the dates for which the X11
terminal test is failing.

Dan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gnuplot and dashed lines

Daniel Sebald
On 12/20/2012 09:02 PM, Daniel J Sebald wrote:
> On 12/20/2012 08:51 PM, Ben Abbott wrote:
>>
[snip]
>> Also, I looked at the "test" plots for x11. I don't see any dashed
>> lines there.
>
> I sent the list a note and I've isolated the dates for which the X11
> terminal test is failing.
>
> Dan

I've figured out how to activate the X11 dashed lines, which I'll
explain.  How to set this up for users when they install could be
challenging.

gnuplot utilizes the standard X11 defined settings interface.  This is
explained in gnuplot under

gnuplot> help set term x11 line_resources

Basically, one puts the definitions for the dash patterns inside a local
.Xdefaults file.  For example

! gnuplot settings
       gnuplot*dashed: on
gnuplot*borderDashes:    0
   gnuplot*axisDashes:   16
  gnuplot*line1Dashes:    0
  gnuplot*line2Dashes:   42
  gnuplot*line3Dashes:   13
  gnuplot*line4Dashes:   44
  gnuplot*line5Dashes:   15
  gnuplot*line6Dashes: 4441
  gnuplot*line7Dashes:   42
  gnuplot*line8Dashes:   13

and then at the shell command line type

shell> xrdb -merge .Xdefaults

I've put the above command in my shell script resource file.  (Try xrdb
-query if you run into problems.)

Given that, the "test" pattern in gnuplot should look reasonable.
Octave line patterns come out reasonable as well.

As for the Qt terminal, I'm able to replicate what you are seeing, i.e.,
the gnuplot test pattern looks reasonable, but nothing seems to happen
when Octave attempts dashed lines.  I have noticed that Qt terminal
doesn't work exactly the same inside gnuplot as does the x11 terminal.
Where commands like

gnuplot> set term x11 dashed
Terminal type set to 'x11'
Options are ' nopersist dashed'
gnuplot> plot x with lines linestyle 2 linecolor 4
gnuplot> plot x with lines linestyle 2 linecolor 5
gnuplot> plot x with lines linestyle 3 linecolor 5

appear to control the line style and color separately for x11, the same
commands in Qt terminal don't:

gnuplot> set term qt dashed
Terminal type set to 'qt'
Options are '0 font "Sans,9" dashed'
gnuplot> plot x with lines linestyle 2 linecolor 4
gnuplot> plot x with lines linestyle 2 linecolor 5
gnuplot> plot x with lines linestyle 3 linecolor 5

The Qt terminal just picks whatever number was set last for the line
style (which has its own set color).

So, I understand this now.  I'll notify gnuplot developers.

Dan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gnuplot and dashed lines

Daniel Sebald
On 12/21/2012 12:39 AM, Daniel J Sebald wrote:

> On 12/20/2012 09:02 PM, Daniel J Sebald wrote:
>> On 12/20/2012 08:51 PM, Ben Abbott wrote:
>>>
> [snip]
>>> Also, I looked at the "test" plots for x11. I don't see any dashed
>>> lines there.
>>
>> I sent the list a note and I've isolated the dates for which the X11
>> terminal test is failing.
>>
>> Dan
>
> I've figured out how to activate the X11 dashed lines, which I'll
> explain. How to set this up for users when they install could be
> challenging.

What we could do is come up with the dash patterns to go along with the
'--', ':' (i.e., slightly alter the lines below, although they are
already pretty close), then put that in the README.gnuplot documentation
file and perhaps put a note on the webpage of where to locate the
information.  I don't think there is much sense to trying to write a
configure/install script for this sort of thing.

Dan


>
> gnuplot utilizes the standard X11 defined settings interface. This is
> explained in gnuplot under
>
> gnuplot> help set term x11 line_resources
>
> Basically, one puts the definitions for the dash patterns inside a local
> .Xdefaults file. For example
>
> ! gnuplot settings
> gnuplot*dashed: on
> gnuplot*borderDashes: 0
> gnuplot*axisDashes: 16
> gnuplot*line1Dashes: 0
> gnuplot*line2Dashes: 42
> gnuplot*line3Dashes: 13
> gnuplot*line4Dashes: 44
> gnuplot*line5Dashes: 15
> gnuplot*line6Dashes: 4441
> gnuplot*line7Dashes: 42
> gnuplot*line8Dashes: 13
>
> and then at the shell command line type
>
> shell> xrdb -merge .Xdefaults
>
> I've put the above command in my shell script resource file. (Try xrdb
> -query if you run into problems.)
>
> Given that, the "test" pattern in gnuplot should look reasonable. Octave
> line patterns come out reasonable as well.
>
> As for the Qt terminal, I'm able to replicate what you are seeing, i.e.,
> the gnuplot test pattern looks reasonable, but nothing seems to happen
> when Octave attempts dashed lines. I have noticed that Qt terminal
> doesn't work exactly the same inside gnuplot as does the x11 terminal.
> Where commands like
>
> gnuplot> set term x11 dashed
> Terminal type set to 'x11'
> Options are ' nopersist dashed'
> gnuplot> plot x with lines linestyle 2 linecolor 4
> gnuplot> plot x with lines linestyle 2 linecolor 5
> gnuplot> plot x with lines linestyle 3 linecolor 5
>
> appear to control the line style and color separately for x11, the same
> commands in Qt terminal don't:
>
> gnuplot> set term qt dashed
> Terminal type set to 'qt'
> Options are '0 font "Sans,9" dashed'
> gnuplot> plot x with lines linestyle 2 linecolor 4
> gnuplot> plot x with lines linestyle 2 linecolor 5
> gnuplot> plot x with lines linestyle 3 linecolor 5
>
> The Qt terminal just picks whatever number was set last for the line
> style (which has its own set color).
>
> So, I understand this now. I'll notify gnuplot developers.
>
> Dan

--

Dan Sebald
email: daniel(DOT)sebald(AT)ieee(DOT)org
URL: http://www(DOT)dansebald(DOT)com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gnuplot and dashed lines

Daniel Sebald
In reply to this post by Daniel Sebald
On 12/21/2012 12:39 AM, Daniel J Sebald wrote:

> On 12/20/2012 09:02 PM, Daniel J Sebald wrote:
>> On 12/20/2012 08:51 PM, Ben Abbott wrote:
>>>
> [snip]
>>> Also, I looked at the "test" plots for x11. I don't see any dashed
>>> lines there.
>>
>> I sent the list a note and I've isolated the dates for which the X11
>> terminal test is failing.
>>
>> Dan
>
> I've figured out how to activate the X11 dashed lines, which I'll
> explain. How to set this up for users when they install could be
> challenging.
>
> gnuplot utilizes the standard X11 defined settings interface. This is
> explained in gnuplot under
>
> gnuplot> help set term x11 line_resources
>
> Basically, one puts the definitions for the dash patterns inside a local
> .Xdefaults file. For example
>
> ! gnuplot settings
> gnuplot*dashed: on
> gnuplot*borderDashes: 0
> gnuplot*axisDashes: 16
> gnuplot*line1Dashes: 0
> gnuplot*line2Dashes: 42
> gnuplot*line3Dashes: 13
> gnuplot*line4Dashes: 44
> gnuplot*line5Dashes: 15
> gnuplot*line6Dashes: 4441
> gnuplot*line7Dashes: 42
> gnuplot*line8Dashes: 13
>
> and then at the shell command line type
>
> shell> xrdb -merge .Xdefaults
>
> I've put the above command in my shell script resource file. (Try xrdb
> -query if you run into problems.)

One doesn't even have to do that much.  On my system .Xresources is the
file name, not .Xdefaults, and no xrdb command is needed.  The
.Xresources file is queried every time a new session is started (log
out, log back in).

Dan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gnuplot and dashed lines

bpabbott
Administrator
In reply to this post by Daniel Sebald

On Dec 21, 2012, at 1:39 AM, Daniel J Sebald wrote:

> On 12/20/2012 09:02 PM, Daniel J Sebald wrote:
>> On 12/20/2012 08:51 PM, Ben Abbott wrote:
>>>
> [snip]
>>> Also, I looked at the "test" plots for x11. I don't see any dashed
>>> lines there.
>>
>> I sent the list a note and I've isolated the dates for which the X11
>> terminal test is failing.
>>
>> Dan
>
> I've figured out how to activate the X11 dashed lines, which I'll explain.  How to set this up for users when they install could be challenging.
>
> gnuplot utilizes the standard X11 defined settings interface.  This is explained in gnuplot under
>
> gnuplot> help set term x11 line_resources
>
> Basically, one puts the definitions for the dash patterns inside a local .Xdefaults file.  For example
>
> ! gnuplot settings
>      gnuplot*dashed: on
> gnuplot*borderDashes:    0
>  gnuplot*axisDashes:   16
> gnuplot*line1Dashes:    0
> gnuplot*line2Dashes:   42
> gnuplot*line3Dashes:   13
> gnuplot*line4Dashes:   44
> gnuplot*line5Dashes:   15
> gnuplot*line6Dashes: 4441
> gnuplot*line7Dashes:   42
> gnuplot*line8Dashes:   13
>
> and then at the shell command line type
>
> shell> xrdb -merge .Xdefaults
>
> I've put the above command in my shell script resource file.  (Try xrdb -query if you run into problems.)
>
> Given that, the "test" pattern in gnuplot should look reasonable. Octave line patterns come out reasonable as well.

I added a section to the wiki.

        http://wiki.octave.org/Enable_%22linestyle%22_functionality_for_Gnuplot%27s_x11_terminal

Ben


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gnuplot and dashed lines

bpabbott
Administrator
In reply to this post by Daniel Sebald

On Dec 21, 2012, at 5:22 AM, Daniel J Sebald wrote:

> On 12/21/2012 12:39 AM, Daniel J Sebald wrote:
>> On 12/20/2012 09:02 PM, Daniel J Sebald wrote:
>>> On 12/20/2012 08:51 PM, Ben Abbott wrote:
>>>>
>> [snip]
>>>> Also, I looked at the "test" plots for x11. I don't see any dashed
>>>> lines there.
>>>
>>> I sent the list a note and I've isolated the dates for which the X11
>>> terminal test is failing.
>>>
>>> Dan
>>
>> I've figured out how to activate the X11 dashed lines, which I'll
>> explain. How to set this up for users when they install could be
>> challenging.
>>
>> gnuplot utilizes the standard X11 defined settings interface. This is
>> explained in gnuplot under
>>
>> gnuplot> help set term x11 line_resources
>>
>> Basically, one puts the definitions for the dash patterns inside a local
>> .Xdefaults file. For example
>>
>> ! gnuplot settings
>> gnuplot*dashed: on
>> gnuplot*borderDashes: 0
>> gnuplot*axisDashes: 16
>> gnuplot*line1Dashes: 0
>> gnuplot*line2Dashes: 42
>> gnuplot*line3Dashes: 13
>> gnuplot*line4Dashes: 44
>> gnuplot*line5Dashes: 15
>> gnuplot*line6Dashes: 4441
>> gnuplot*line7Dashes: 42
>> gnuplot*line8Dashes: 13
>>
>> and then at the shell command line type
>>
>> shell> xrdb -merge .Xdefaults
>>
>> I've put the above command in my shell script resource file. (Try xrdb
>> -query if you run into problems.)
>
> One doesn't even have to do that much.  On my system .Xresources is the file name, not .Xdefaults, and no xrdb command is needed.  The .Xresources file is queried every time a new session is started (log out, log back in).
>
> Dan

I assume that the filename passed to xrdb can be anything?  If so, I'll use that with the Octave application bundle I'm working on.

Ben

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gnuplot and dashed lines

bpabbott
Administrator
In reply to this post by bpabbott
On Dec 20, 2012, at 10:55 AM, Ben Abbott wrote:

> On Dec 20, 2012, at 10:46 AM, CdeMills wrote:
>
>> Hello,
>>
>> I was struggling to obtain dashed lines without success. At first I believe
>> it was MacOs specific; now I've found the problem.
>>
>> If you take the content of
>> http://gnuplot.sourceforge.net/demo/dashcolor.html
>> and paste it into gnuplot interface, you get the same figure as given on the
>> web page. If you download the script provided at
>> http://gnuplot.sourceforge.net/demo/dashcolor.1.gnu which is supposed to
>> give exactly the same result, you don't.
>>
>> There is a subtle difference: the script does not include the 'set
>> termoption dashed' command at the beginning. This makes a lot of
>> differences: by default, it seems that gnuplot renders all lines as solid.
>>
>> To verify, it tried this simple script:
>> x = 1:10;
>> h=plot (x,x,'-;line 1;',x,x+1,'--;line 2;')
>>
>> I got a figure with two continuous lines. Then I did
>> drawnow("aqua", "/dev/null", false, "debug.gp")
>> edited the debug.gp file, added a "set term option dashed" at the beginning,
>> then, in a terminal:
>> gnuplot < debug.gp
>>
>> and got the dashed lines ! The missing point is thus to add this
>> "termoption" at the beginning of the gnuplot script. Another option is to
>> create a "~/.gnuplot" with this line:
>> set termoption dashed
>>
>> Restarted Octave, ran the same script, and got a dashed line directly!
>> Dash-dot working too.
>>
>> This should be either corrected into the gnuplot interface, either
>> documented. Moreover, gnuplot seems to not have a way to query the
>> termoption settings. I don't see how to interactively test wether or not
>> this feature is supported.
>>
>> Regards
>>
>> Pascal
>
> If you are intetested in making a changeset, the place for this change is in __gnuplot_drawnow__.m, or in __go_draw_figure__.m
>
> Ben

Pascal,

I pushed the change below.

        http://hg.savannah.gnu.org/hgweb/octave/rev/1ea5f8a4a914

Ben


Loading...