[vtkusers] Problems with vtkXYPlotActor

burlen burlen at apollo.sr.unh.edu
Sat Aug 11 11:00:03 EDT 2007


Hi Chuck,

in regards to exchanging the x-y axis: try to use the 
SetDataObjectPlotModeToRows
method. I took a look at the source and it seems that the 
SetExchangeAxis method only affects the axes not the data, but 
SetDataObjectPlotModeToRows apparently switches the data.

V.SetDataObjectPlotModeToRows()
C++: void SetDataObjectPlotModeToRows ();this SetDataObjectPlotMode 
VTK_XYPLOT_ROW

 Indicate whether to plot rows or columns. If plotting rows, then
 the dependent variables is taken from a specified row,
 versus rows (y).

in regards to the number of axis labels I think it is a bug in vtk. The 
reason I say this is that vtkXYPlotActor uses vtkAxisActor2D to make 
each axis. From the source code of that class it seems that if  the 
variable AdjustLabels is set to true then vtk basically ignores the 
NumberOfLabels variable. So that to get a specific number of labels in 
addition to SetNumberOfXLabels & SetNumberOfYLabels one also has to to 
set AdjustLabelsOff. the vtkXYPlotActor doesn't do this and I don't see 
an easy way for you to do this from the vtkXYPoltActor, but you should 
take a closer look to check me on that.

V.AdjustLabelsOff()
C++: void AdjustLabelsOff ();

 Set/Get the flag that controls whether the labels and ticks are
 adjusted for "nice" numerical values to make it easier to read
 the labels. The adjustment is based in the Range instance variable.
 Call GetAdjustedRange and GetAdjustedNumberOfLabels to get the adjusted
 range and number of labels.

My disclaimer is that I just read the sources here I didn't actually 
verify my conclusions with an example so I may have overlooked something.

By the way I would not bother with 2-d plots in vtk, the quality is very 
low compared to what can be achieved by using matlab or an equivalent. I 
have been using vtk since 4.2  and I haven't seen any improvement in the 
2d plotting facility over the new releases...

good luck!

-- 
Burlen Loring
Information Technologist III
Space Science Center
Institute for the Study of Earth, Oceans, and Space
University of New Hampshire
39 College Road, Durham, NH 03824
Phone: 603-862-1140



Chuck Anderson wrote:
> Hi Everyone,
>
> I am using vtkXYPlotActor and it is not working properly. I'm hoping to get
> guidance on whether I'm doing something stupid or if there are problems with
> the class.
>
> First issue is the "setNumberOfXLabels" and "SetNumberOfYLabels" have no
> effect.
>
> Second, the ExchangeAxes setting will swap the X and Y axes labels and
> titles, but the data plot does not reflect a swapping of axes, it plots the
> same regardless of whether the ExchangeAxes is set to on or off.
>
> I am using a relatively recent stable release of VTK 5.0 and scripting in
> Tcl. I see the same behavior on my Mac and PC running XP.
>
> Any guidance would be greatly appreciated.
>
> Cheers,
> Chuck
>
> --------------------------------------
> Chuck Anderson
> Visualization and Outreach Specialist
> Center for Environmental Kinetics Analysis (CEKA)
> Penn State
> 2217 EES Building
> 814-863-2049
> cda10 at psu.edu
>  
>
>
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>   




More information about the vtkusers mailing list