bugGNU Octave - Bugs: bug #34119, plotyy more restrictive that plot

 
 

bug #34119: plotyy more restrictive that plot

Submitted by:  None
Submitted on:  Wed 24 Aug 2011 05:40:59 PM UTC  
 
Category: Plotting with gnuplotSeverity: 1 - Wish
Priority: 1 - LaterItem Group: Feature Request
Status: Need InfoAssigned to: None
Originator Name: Originator Email: -unavailable-
Open/Closed: ClosedRelease: 3.4.0
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Sat 17 Sep 2011 12:53:19 AM UTC, comment #12:

As there's been no response, I'm closing this ticket.

Ben Abbott <bpabbott>
Project Member
Thu 01 Sep 2011 10:06:50 AM UTC, comment #11:

anon,

The plotyy behavior you objected below in comment #10 is the intended behavior. This behavior is consistent/compatible with Matlab.

Regarding open-source mentality, we are all here as volunteers. New volunteers are always welcome. If you'd like to see a change made, please contribute a modified plotyy for consideration.

If you're contribution maintains compatibility with Matlab, adds utility, and is coded in a manner consistent with the current sources, I'm confident there will no objection to applying it.

Ben Abbott <bpabbott>
Project Member
Thu 01 Sep 2011 09:16:18 AM UTC, comment #10:

No, the untested suggestion posted in #5 does not produce the output you imagined it would.

# test ability to plot three lines on plotyy() graph

x=y=y2=[1:10];
y3=[6:15];
plotyy(x,y,x,y2);
hold on
plot(x,y3);
hold off

The third line is plotted on the scale of y2 axis but is coloured to indicate it relates to y1 axis. Output is invalid.

Yet again this shows that plotyy() is a hack. This sort of ad hoc . bolt-on solution with unseen, undocumented affects on what axis is "current" etc will be a constant cause of bugs, dysfunction and confusion.

I already suggested that this functionality could probably be incorporated into the existing plot() by simple addition of an option 'axes' =[x1y1,x2y2,x1y2,,x2y1]

This is already available in gnuplot and would require minimal coding to implement.

plot could then return three (or more) args as per plotyy() and remain compatible with existing code expecting one return arg.

from man plot:

Here are some plot examples:

plot (x, y, "@12", x, y2, x, y3, "4", x, y4, "+")

So apparently plot() can already parse an undetermined number of x,y plots with options interspersed.

This would get around all the (undocumented) special cases that occur with the implicit "current axis" paradigm and probably reduce the size of the code base.

The true x2axis could go at the top and actually be a useful feature.

ylabel() and friends could take an explicit optional second arg if they need to be directed to y2axis etc.

The resulting code would probably be simple and easier to maintain (and hopefully document!).

I am fully aware that the current mindset in the project is refractory to outside suggestions (most open source project are run by defensive cliques) but at least this possible solution is logged in the system should anyone wish to fix this mess at some later time.

Anonymous
Sat 27 Aug 2011 08:31:56 PM UTC, comment #9:

OK , lets assume I have some meteo data for two sites: wind speed and direct at each site as a time series.

common x axis is time . I have four datasets for y two with units of direction (degrees) ; two with units of speed (mph).

With your suggested solution in #5 it seems I can only plot three of these with octave since there is no way to get two plots onto y1 using plotyy.

As for how plotyy could know, as I already stated, plot seems to manage for example, to set marker and legend for any number of plots. It is done by order. Why is this a show stopper for plotyy?

while many of the special case format marker used in plot() seem a bit arcane, it could be done in a similar way. At least it would be easier to remember if the two fns were to work in a similar way.

Maybe if the two could be unified it would be more consistent and easier.

If plot() could take an argument similar to gnuplots axes=x1y2 the plotyy could be redundant.

Most octave functions seem to have very flexible argument handling, I'm surprised that you see this a problem.

Anonymous
Sat 27 Aug 2011 03:38:59 PM UTC, comment #8:

I don't understand how you expect this to be implemented. How would plotyy know which pairs of x-y values go for the first y axis and which ones go for the second y axis, if there isn't "first pair, second pair" because now there are n pairs?

Can you show me an example of the plot you expect to produce (attach the graphic here) so I can see where you're going with this?

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Sat 27 Aug 2011 11:51:33 AM UTC, comment #7:

hold on
parse error:

syntax error

>>> hold on

^

according to help this is correct , why is it getting an error?

Anonymous
Sat 27 Aug 2011 08:13:21 AM UTC, comment #6:

Yes, that provides a solution for my individual example. Thanks.

However, it seems to imply that one of the axes (the first one used) can only be used for one plot.

A more general case where a number of plots may require one or other axis does not seem to be possible.(you did not address the xd4,yd4 in my example)

Also adding options to various plots as I indicated is not addressed by this solution.

Couldn't the arguments be parsed in a more compatible way between plot and plotyy?

The arguments to these two closely related functions seems to be parsed totally differently.

Having got things to work with plot() I find I have to pretty much structure the whole thing to add a second y axis.

Anonymous
Sat 27 Aug 2011 12:24:41 AM UTC, comment #5:

You can do it with hold.

I think your proposed extension is not necessary, since the same can be accomplished other ways. I'm marking this bug as wishlist and setting its priority to low. I hope you agree.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Sat 27 Aug 2011 12:17:01 AM UTC, comment #4:

I don't really understand how the fairly flexible argument lists of plot() are parsed but I imagine plotyy could be done in a similar way.

Currently it is a bit illogical that they function so differently (specifying linestyle, legend titles etc seems to be completely a different mechanism).

For the multiple plots:

plotyy(x1,y1,"axes", "x1,y2","other_opt","opt_value", xd2,yd2,"axes","x2y2",xd3,yd3,"axes","x2y2",xd4,yd4);

xd4,yd4 by default plots on x1y1 .

The argument list could be extensible as is the case for plot.

I currently have two datasets that have the same scale and a third that is different. I can't do it with plot because I need two scales but I cant do it with plotyy because it can't take three datasets.

As it works now, I need to dump out to a text file and use gnuplot directly on the data. It would be nice if I could skip that drudgery.

Anonymous
Fri 26 Aug 2011 08:27:59 PM UTC, comment #3:

Can you please write an example of the command you expect to work and a brief explanation of what you think this command should do?

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Fri 26 Aug 2011 07:59:50 PM UTC, comment #2:

Well how does plot handle it? It seems odd to have less plot lines possible on two axes than there was on one.

I don't see where I suggested more than two y-axes.

gnuplot allows the axes for each plot line to be specified as 'axes x2,y2' for ex. That would be one solution.

I can plot three lines on one x axis but not on two :?

Anonymous
Wed 24 Aug 2011 06:07:25 PM UTC, comment #1:

Well, it's called "plotyy", not "plotyyyyyyyy", and I don't really see where would you put more y axes if you've already used the left and right vertical axes to label your plot.

What sort of functionality are you expecting?

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Wed 24 Aug 2011 05:40:59 PM UTC, original submission:

plot can take a list of data pairs to plot but does it all on one y axis.

plotyy is a good extension but seems only to allow two plotted datasets. Why?

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bpabbott (Posted a comment)
  • -unavailable- added by bpabbott
  • -unavailable- added by jordigh (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 17 Sep 2011 12:53:19 AM UTCbpabbottOpen/ClosedOpen=>Closed
    Wed 31 Aug 2011 02:00:38 AM UTCbpabbottCarbon-Copy-=>Added -unavailable-
    Sat 27 Aug 2011 12:24:41 AM UTCjordighSeverity3 - Normal=>1 - Wish
      Priority5 - Normal=>1 - Later
    Fri 26 Aug 2011 08:27:59 PM UTCjordighStatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1