]> SALOME platform Git repositories - modules/paravis.git/blob - test/VisuPrs/SWIG_scripts/B7.py
Salome HOME
Update copyrights 2014.
[modules/paravis.git] / test / VisuPrs / SWIG_scripts / B7.py
1 # Copyright (C) 2010-2014  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # This case corresponds to: /visu/SWIG_scripts/B7 case
21 # Import a table from file and show it in 2D viewer
22
23 from paravistest import tablesdir
24 from presentations import *
25 import paravis
26 import pvsimple
27
28
29 # Import table from CSV file
30 file_path = tablesdir + "table_test.csv"
31 table_csv = pvsimple.CSVReader(FileName=file_path)
32
33 # Set space as separator
34 table_csv.FieldDelimiterCharacters = ';'
35
36 # Display curve
37 cur_view = pvsimple.GetRenderView()
38 if cur_view:
39     pvsimple.Delete(cur_view)
40 xy_view = pvsimple.CreateXYPlotView()
41
42 xy_rep = pvsimple.Show(table_csv)
43 xy_rep.AttributeType = 'Row Data'
44 xy_rep.UseIndexForXAxis = 0
45 xy_rep.XArrayName = 'X'
46 xy_rep.SeriesVisibility = ['X', '0']
47
48 # Set view properties
49 title = xy_view.ChartTitle
50 xy_view.ChartTitle = "Change the title from python"
51 pvsimple.Render(xy_view)
52
53 axis_title = xy_view.AxisTitle
54 xy_view.AxisTitle[0] = "Y axis"
55 xy_view.AxisTitle[1] = "X axis"
56 pvsimple.Render(xy_view)
57
58 xy_view.ShowLegend = 0
59 pvsimple.Render(xy_view)
60
61 xy_view.ShowAxis = [0, 0, 0, 0]
62 pvsimple.Render(xy_view)
63 xy_view.ShowAxis = [1, 0, 0, 0]
64 pvsimple.Render(xy_view)
65 xy_view.ShowAxis[1] = 1
66 pvsimple.Render(xy_view)
67
68 # Set logarithmic scaling
69 xy_view.AxisLogScale[0] = 1
70 pvsimple.Render(xy_view)
71 xy_view.AxisLogScale[1] = 1
72 pvsimple.Render(xy_view)
73
74 # Set representation properties
75
76 # Show/hide curves
77 xy_rep.SeriesVisibility = ['Y0', '0', 'Y1', '0',
78                            'Y2', '0', 'Y3', '0']
79 pvsimple.Render(xy_view)
80 xy_rep.SeriesVisibility = ['Y0', '1']
81 pvsimple.Render(xy_view)
82 xy_rep.SeriesVisibility = ['Y1', '1']
83 pvsimple.Render(xy_view)
84 xy_rep.SeriesVisibility = ['Y2', '1']
85 pvsimple.Render(xy_view)
86
87 xy_rep.SeriesVisibility = ['Y3', '1']
88 xy_rep.SeriesVisibility = ['Y3', '0']
89 xy_rep.SeriesVisibility = ['Y3', '1']
90 pvsimple.Render(xy_view)
91
92 # Line style
93 xy_rep.SeriesLineStyle = ['Y0', '5']
94 pvsimple.Render(xy_view)
95 xy_rep.SeriesLineStyle = ['Y1', '4']
96 pvsimple.Render(xy_view)
97 xy_rep.SeriesLineStyle = ['Y2', '3']
98 pvsimple.Render(xy_view)
99 xy_rep.SeriesLineStyle = ['Y3', '2']
100 pvsimple.Render(xy_view)
101
102 # Line thickness
103 values = (2, 4, 6, 8, 10, 1)
104 for val in values:
105     xy_rep.SeriesLineThickness = ['Y3', str(val)]
106     pvsimple.Render(xy_view)
107
108 xy_rep.SeriesLineStyle = ['Y3', '0']
109 pvsimple.Render(xy_view)
110
111 # Marker type
112 xy_rep.SeriesMarkerStyle = ['Y3', '5']
113 pvsimple.Render(xy_view)
114 xy_rep.SeriesMarkerStyle = ['Y2', '4']
115 pvsimple.Render(xy_view)
116 xy_rep.SeriesMarkerStyle = ['Y1', '3']
117 pvsimple.Render(xy_view)
118 xy_rep.SeriesMarkerStyle = ['Y0', '8']
119 pvsimple.Render(xy_view)
120
121 # Marker size
122 for val in values:
123     xy_rep.SeriesLineThickness = ['Y3', str(val)]
124     pvsimple.Render(xy_view)