|
From: Alain B. <ala...@la...> - 2009-07-23 08:25:34
|
Dear all i 'd like to create my function for drawing the legend of graph, i want to modify line width for the legend, and font color and reset to previous value before exiting the legend function. so i need to know current line width, line color I found no function that gives me this informations (no plg...) Am i wrong ? how could i get this information ? Regards Alain baeckeroot |
|
From: Hazen B. <hba...@ma...> - 2009-07-23 15:27:14
|
Alain Baeckeroot wrote: > Dear all > > i 'd like to create my function for drawing the legend of graph, > i want to modify line width for the legend, and font color and reset > to previous value before exiting the legend function. so i need to know > current line width, line color > > I found no function that gives me this informations (no plg...) > Am i wrong ? > how could i get this information ? I believe you are correct. Could you describe the problem that you are facing a little more? In PLplot the defaults are just whatever they were last set to. I think that they start at plwid(1) with plcol0(0) as the background color and plcol0(1) as the foreground color. -Hazen |
|
From: Schwartz, S. J <s.s...@im...> - 2009-07-24 07:29:21
|
As someone who has switched from plplot's mother (grandmother?) pgplot I would remark that pgplot has all these "get" routines as well as a nestable pgsave/pgunsave that would remember a whole set of attributes including (from memory) line thickness, colour, style, fill pattern. I use these all the time so that I can go plot something specific and know I can get back to the precious settings. If, for example, you want to thicken all the axes but not all the plot limes this mechanism liberal use of save/unsave is easy and robust. It also prevents axes coming out as dashed red lines. It can also be useful if you jump around between subpages. Of course, it's easy to write one's own wrappers or hold what you want in some struct, but then you need to do this, pass such a struct around ( or worse declare it global) or whatever. I assume all this information is remembered by pllplot in the stream or somewhere so this is just a question of addind the user-visible api. I respect the plplot desire to keep the api minimalisitc, so there is always a trade off here. Hence this email to illustrate how "get" routines, and save/ unsave are used. Regards Steve ----------- Steve Schwartz Space and Atmospheric Physics Imperial College London Tel 020 7594 7660 On 24 Jul 2009, at 02:05, "Hazen Babcock" <hba...@ma...> wrote: > Alain Baeckeroot wrote: >> Dear all >> >> i 'd like to create my function for drawing the legend of graph, >> i want to modify line width for the legend, and font color and reset >> to previous value before exiting the legend function. so i need to >> know >> current line width, line color >> >> I found no function that gives me this informations (no plg...) >> Am i wrong ? >> how could i get this information ? > > I believe you are correct. Could you describe the problem that you are > facing a little more? In PLplot the defaults are just whatever they > were > last set to. I think that they start at plwid(1) with plcol0(0) as the > background color and plcol0(1) as the foreground color. > > -Hazen > > > --- > --- > --- > --------------------------------------------------------------------- > _______________________________________________ > Plplot-general mailing list > Plp...@li... > https://lists.sourceforge.net/lists/listinfo/plplot-general |
|
From: Alain B. <ala...@la...> - 2009-07-23 16:35:47
|
Le 23/07/2009 à 17:27, Hazen Babcock a écrit : > > Alain Baeckeroot wrote: > > Dear all > > > > i 'd like to create my function for drawing the legend of graph, > > i want to modify line width for the legend, and font color and reset > > to previous value before exiting the legend function. so i need to know > > current line width, line color > > > > I found no function that gives me this informations (no plg...) > > Am i wrong ? > > how could i get this information ? > > I believe you are correct. Could you describe the problem that you are > facing a little more? In PLplot the defaults are just whatever they were > last set to. I think that they start at plwid(1) with plcol0(0) as the > background color and plcol0(1) as the foreground color. > > -Hazen > I plot on the same graph Text and Tint, from octave : ... various settings including naming colors (blue = 9, green = 3) #TExt plcol0(blue); plwid (width); plline(x, temper(:,text)); legende(1, "T Ext", xmin, xmax, ymin, ymax); #Tint plcol0(green); plwid (width); # needed to set width again <----------------------- plline(x, temper(:,tint)); legende(2, "T Int", xmin, xmax, ymin, ymax); function legende ( num, text, xmin, xmax, ymin, ymax ) ## draw legend on top left of the graph. ## (or top right if xmin > xmax ....) ## dx = (xmax - xmin) / 20.; dy = (ymax - ymin) / 20.; x(1) = xmin + dx; x(2) = x(1) + 2 * dx; xt = x(2) + dx; y(1) = ymax - num * dy; y(2) = y(1); yt = y(1); plwid ( 6 ); plline (x', y'); palette; # colormap with names for each color plcol0(grey); # text is written in grey plptex ( xt, yt, 0, 0, 0, text); endfunction As i set width in legend, i need to set it again in the main loop. Also i need to pass (xmin xmax ymin ymax) as i dont know how to just say draw at x = 10% of window .... ideally i would like to have just : legend (num, text) and all other informations from some plgxyz inside legend function. I hope my explainations are clear enought this time :) Alain PS: i m on the list, thanks for CCing me, buts it is not needed. |
|
From: Alan W. I. <ir...@be...> - 2009-07-23 19:21:16
|
On 2009-07-23 18:35+0200 Alain Baeckeroot wrote: > PS: i m on the list, thanks for CCing me, buts it is not needed. Alain, that's completely under your control. By default if there is a potential duplicate e-mail (e.g., via list and CC), the SourceForge mailing software will drop the duplicate. However, from your remarks it sounds like that option has somehow been disabled in your case (or you subscribed so long ago that no-dup option was not the default then). I suggest you go to https://lists.sourceforge.net/lists/listinfo/plplot-general --> "Unsubscribe or edit options" and enable that "no-dup" option. I have put it in quotes because I cannot remember its exact name, but with a little digging amongst all the mailing-list options under your control you should be able to find it. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |
|
From: Hazen B. <hba...@ma...> - 2009-07-23 18:05:39
|
Alain Baeckeroot wrote: > Le 23/07/2009 à 17:27, Hazen Babcock a écrit : >> Alain Baeckeroot wrote: >>> Dear all >>> >>> i 'd like to create my function for drawing the legend of graph, >>> i want to modify line width for the legend, and font color and reset >>> to previous value before exiting the legend function. so i need to know >>> current line width, line color >>> >>> I found no function that gives me this informations (no plg...) >>> Am i wrong ? >>> how could i get this information ? >> I believe you are correct. Could you describe the problem that you are >> facing a little more? In PLplot the defaults are just whatever they were >> last set to. I think that they start at plwid(1) with plcol0(0) as the >> background color and plcol0(1) as the foreground color. >> >> -Hazen >> > > I plot on the same graph Text and Tint, from octave : > > ... various settings including naming colors (blue = 9, green = 3) > > #TExt > plcol0(blue); > plwid (width); > plline(x, temper(:,text)); > legende(1, "T Ext", xmin, xmax, ymin, ymax); > > #Tint > plcol0(green); > plwid (width); # needed to set width again <----------------------- > plline(x, temper(:,tint)); > legende(2, "T Int", xmin, xmax, ymin, ymax); > > > > function legende ( num, text, xmin, xmax, ymin, ymax ) > ## draw legend on top left of the graph. > ## (or top right if xmin > xmax ....) > ## > dx = (xmax - xmin) / 20.; > dy = (ymax - ymin) / 20.; > > x(1) = xmin + dx; > x(2) = x(1) + 2 * dx; > xt = x(2) + dx; > > y(1) = ymax - num * dy; > y(2) = y(1); > yt = y(1); > > plwid ( 6 ); > plline (x', y'); > palette; # colormap with names for each color > plcol0(grey); # text is written in grey > plptex ( xt, yt, 0, 0, 0, text); > > endfunction > > > > > As i set width in legend, i need to set it again in the main loop. > Also i need to pass (xmin xmax ymin ymax) as i dont know how > to just say draw at x = 10% of window .... > > ideally i would like to have just : > legend (num, text) > and all other informations from some plgxyz inside legend function. > > I hope my explainations are clear enought this time :) I think you should be able to get xmin, xmax, ymin and ymax using the function plgvpw(). At present the only way I can see to handle the width issue is to write a wrapper function for plwid() that saves the previous pen width so you can revert the width as necessary. -Hazen |
|
From: Jerry <lan...@qw...> - 2009-07-23 19:52:41
|
On Jul 23, 2009, at 1:25 AM, Alain Baeckeroot wrote: > Dear all > > i 'd like to create my function for drawing the legend of graph, > i want to modify line width for the legend, and font color and reset > to previous value before exiting the legend function. so i need to > know > current line width, line color > > I found no function that gives me this informations (no plg...) > Am i wrong ? > how could i get this information ? > > Regards > Alain baeckeroot > Hi Alain, PLplot has more "setter" functions than "getter" functions which can be problematic as you have found. The Ada bindings augment the PLplot API with a snapshot facility for color map 0. You might find this useful--search plplot_traditional.ads and plplot_traditional.adb for the string "snapshot". With this, you can preserve the state of color map 0 at any time and restore it later after having made changes. In addition, the default state of color map 0 is available at all times (in Ada). Perhaps you can borrow from this code to use in Octave. As for preserving the pen width, you might have to set it specifically to your own width and then remember that globally so that you can reset it later. This sounds like the wrapper idea of Hazen's. I'm sure that you noticed the inconsistency with the name of the function to set pen width, plwid instead of plswid as is conventional with other setter functions. (And no plgwid.) Hope this helps. Jerry Ada sources in SVN (beware line wrap): http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/bindings/ada/plplot_traditional.ads.cmake?revision=9999&view=markup http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/bindings/ada/plplot_traditional.adb.cmake?revision=9378&view=markup |