[Paraview] 2D Plotting
Weirs, V Gregory
vgweirs at sandia.gov
Tue Apr 29 14:05:15 EDT 2008
Are you using the Plot-Over-Time filter? For the second issue, you can right-click in the Plot-Over-Time view and select Properties in the menu that pops up. This should give you a window, and then you can find the axis you want, then click Layout and it will let you pick the axis scale behavior.
This feature (getting to the properties window) is very well hidden.
Hope this helps-
Greg
On 4/29/08 11:46 AM, "Herbert Mullens" <herbert.mullens at imts.us> wrote:
I am writing a custom reader for a client that needs to display an XY Plot for a given time step. I am reading in their data from a text file and outputting a vtkRectilinearGrid data object. I am currently having two issues.
The first issue is that I can not get the plot to use the correct array as the X coordinates. The data has three arrays, stress, strain, and time. I want to plot stress versus strain. Setting the time array as the X Coordinate uses the time values as my x axis, but setting any other array as the X coordinate results in the Y axis array's index being used.
The second issue is that the range of the axes change based off of the range of the data that is currently loaded. I would like the range on the axes to stay constant for every time step. The effect they want is one of the plot being drawn as the time step changes. With the range changing every step the results look confusing. Is there any way to change this behavior?
Any help that can be offered will be greatly appreciated. I am including a code snippet below from the RequestData method of my class showing the code that creates, fills, and uses the arrays.
Thank you,
Herb
------------------------ Begin code snippet-------------------------------
output->SetDimensions(this->numberOfTimeSteps, 1, 1);
vtkDoubleArray* stress_data = vtkDoubleArray::New();
vtkDoubleArray* strain_data = vtkDoubleArray::New();
vtkDoubleArray* time_data = vtkDoubleArray::New();
vtkPointData* points = output->GetPointData();
stress_data->SetName("Stress");
stress_data->SetNumberOfComponents(1);
stress_data->SetNumberOfTuples(requested_time_step);
strain_data->SetName("Strain");
strain_data->SetNumberOfComponents(1);
strain_data->SetNumberOfTuples(requested_time_step);
time_data->SetName("Time");
time_data->SetNumberOfComponents(1);
time_data->SetNumberOfTuples(requested_time_step);
// Create dummy array for y and z values
vtkDoubleArray* empty = vtkDoubleArray::New();
empty->SetNumberOfComponents(1);
empty->SetNumberOfTuples(1);
empty->SetTuple1(0, 0.0);
output->SetYCoordinates(empty);
output->SetZCoordinates(empty);
// Fill in the data arrays.
// Now start processing data and writing it to the vtkDoubleArrays.
double stress_temp, strain_temp;
for ( int i = 0; i <= requested_time_step; i++ )
{
file >> stress_temp >> strain_temp;
time_data->SetTuple1(i, i);
stress_data->SetTuple1(i, stress_temp);
strain_data->SetTuple1(i, strain_temp);
}
points->AddArray(time_data);
points->AddArray(stress_data);
points->AddArray(strain_data);
output->SetXCoordinates(stress_data);
time_data->Delete();
stress_data->Delete();
strain_data->Delete();
empty->Delete();
------------------------ End code snippet---------------------------------
--
V. Gregory Weirs
Sandia National Laboratories vgweirs at sandia.gov
P.O.Box 5800, MS 0378 phone: 505 845 2032
Albuquerque, NM 87185-0378 fax: 505 284 0154
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20080429/4c818226/attachment.htm>
More information about the ParaView
mailing list