fplot 1.7.1
A Fortran library providing a convenient interface for plotting with Gnuplot.
Loading...
Searching...
No Matches
fplot_scatter_plot_data.f90
1! fplot_scatter_plot_data.f90
2
3submodule(fplot_core) fplot_scatter_plot_data
4contains
5! ------------------------------------------------------------------------------
6 module function spd_get_cmd(this) result(x)
7 ! Arguments
8 class(scatter_plot_data), intent(in) :: this
9 character(len = :), allocatable :: x
10
11 ! Local Variables
12 type(string_builder) :: str
13 integer(int32) :: n
14 type(color) :: clr
15
16 ! Initialization
17 call str%initialize()
18
19 ! Title
20 n = len_trim(this%get_name())
21 if (n > 0) then
22 call str%append(' "-" title "')
23 call str%append(this%get_name())
24 call str%append('"')
25 else
26 call str%append(' "-" notitle')
27 end if
28
29 ! Lines, points, or filled
30 if (this%get_fill_curve()) then
31 call str%append(" with filledcurves")
32 else
33 if (this%get_draw_line() .and. this%get_draw_markers()) then
34 call str%append(" with linespoints")
35 else if (.not.this%get_draw_line() .and. this%get_draw_markers()) then
36 call str%append(" with points")
37 else
38 call str%append(" with lines")
39 end if
40 end if
41
42 ! Line Width
43 call str%append(" lw ")
44 call str%append(to_string(this%get_line_width()))
45
46 ! Line Color
47 if (this%get_use_data_dependent_colors()) then
48 ! http://www.gnuplotting.org/using-a-palette-as-line-color/
49 call str%append(" lc palette")
50 else
51 clr = this%get_line_color()
52 call str%append(' lc rgb "#')
53 call str%append(clr%to_hex_string())
54 call str%append('"')
55 end if
56
57 ! Define other properties specific to the lines and points
58 if (this%get_draw_line()) then
59 call str%append(" lt ")
60 call str%append(to_string(this%get_line_style()))
61 if (this%get_line_style() /= line_solid) then
62 call str%append(" dashtype ")
63 call str%append(to_string(this%get_line_style()))
64 end if
65 end if
66 if (this%get_draw_markers()) then
67 call str%append(" pi ")
68 call str%append(to_string(this%get_marker_frequency()))
69 call str%append(" pt ")
70 call str%append(to_string(this%get_marker_style()))
71 call str%append(" ps ")
72 if (this%get_use_variable_size_points()) then
73 call str%append("variable")
74 else
75 call str%append(to_string(this%get_marker_scaling()))
76 end if
77 end if
78
79 ! Define the axes structure
80 call str%append(" ")
81 call str%append(this%get_axes_string())
82
83 ! End
84 x = char(str%to_string())
85 end function
86
87! ------------------------------------------------------------------------------
88 pure module function spd_get_line_width(this) result(x)
89 class(scatter_plot_data), intent(in) :: this
90 real(real32) :: x
91 x = this%m_lineWidth
92 end function
93
94! --------------------
95 module subroutine spd_set_line_width(this, x)
96 class(scatter_plot_data), intent(inout) :: this
97 real(real32), intent(in) :: x
98 this%m_lineWidth = x
99 end subroutine
100
101! ------------------------------------------------------------------------------
102 pure module function spd_get_line_style(this) result(x)
103 class(scatter_plot_data), intent(in) :: this
104 integer(int32) :: x
105 x = this%m_lineStyle
106 end function
107
108! --------------------
109 module subroutine spd_set_line_style(this, x)
110 class(scatter_plot_data), intent(inout) :: this
111 integer(int32), intent(in) :: x
112 if (x == line_dashed .or. &
113 x == line_dash_dotted .or. &
114 x == line_dash_dot_dot .or. &
115 x == line_dotted .or. &
116 x == line_solid) then
117 ! Only reset the line style if it is a valid type.
118 this%m_lineStyle = x
119 end if
120 end subroutine
121
122! ------------------------------------------------------------------------------
123 pure module function spd_get_draw_line(this) result(x)
124 class(scatter_plot_data), intent(in) :: this
125 logical :: x
126 x = this%m_drawLine
127 end function
128
129! --------------------
130 module subroutine spd_set_draw_line(this, x)
131 class(scatter_plot_data), intent(inout) :: this
132 logical, intent(in) :: x
133 this%m_drawLine = x
134 end subroutine
135
136! ------------------------------------------------------------------------------
137 pure module function spd_get_draw_markers(this) result(x)
138 class(scatter_plot_data), intent(in) :: this
139 logical :: x
140 x = this%m_drawMarkers
141 end function
142
143! --------------------
144 module subroutine spd_set_draw_markers(this, x)
145 class(scatter_plot_data), intent(inout) :: this
146 logical, intent(in) :: x
147 this%m_drawMarkers = x
148 end subroutine
149
150! ------------------------------------------------------------------------------
151 pure module function spd_get_marker_style(this) result(x)
152 class(scatter_plot_data), intent(in) :: this
153 integer(int32) :: x
154 x = this%m_markerType
155 end function
156
157! --------------------
158 module subroutine spd_set_marker_style(this, x)
159 class(scatter_plot_data), intent(inout) :: this
160 integer(int32), intent(in) :: x
161 if (x == marker_asterisk .or. &
162 x == marker_empty_circle .or. &
163 x == marker_empty_nabla .or. &
164 x == marker_empty_rhombus .or. &
165 x == marker_empty_square .or. &
166 x == marker_empty_triangle .or. &
167 x == marker_filled_circle .or. &
168 x == marker_filled_nabla .or. &
169 x == marker_filled_rhombus .or. &
170 x == marker_filled_square .or. &
171 x == marker_filled_triangle .or. &
172 x == marker_plus .or. &
173 x == marker_x) then
174
175 ! Only alter the value if the marker is a known type
176 this%m_markerType = x
177 end if
178 end subroutine
179
180! ------------------------------------------------------------------------------
181 pure module function spd_get_marker_scaling(this) result(x)
182 class(scatter_plot_data), intent(in) :: this
183 real(real32) :: x
184 x = this%m_markerSize
185 end function
186
187! --------------------
188 module subroutine spd_set_marker_scaling(this, x)
189 class(scatter_plot_data), intent(inout) :: this
190 real(real32), intent(in) :: x
191 this%m_markerSize = x
192 end subroutine
193
194! ------------------------------------------------------------------------------
195 pure module function spd_get_marker_frequency(this) result(x)
196 class(scatter_plot_data), intent(in) :: this
197 integer(int32) :: x
198 x = this%m_markerFrequency
199 end function
200
201! --------------------
202 module subroutine spd_set_marker_frequency(this, x)
203 class(scatter_plot_data), intent(inout) :: this
204 integer(int32), intent(in) :: x
205 this%m_markerFrequency = x
206 end subroutine
207
208! ------------------------------------------------------------------------------
209 pure module function spd_get_simplify_data(this) result(x)
210 class(scatter_plot_data), intent(in) :: this
211 logical :: x
212 x = this%m_simplifyData
213 end function
214
215! --------------------
216 module subroutine spd_set_simplify_data(this, x)
217 class(scatter_plot_data), intent(inout) :: this
218 logical, intent(in) :: x
219 this%m_simplifyData = x
220 end subroutine
221
222! ------------------------------------------------------------------------------
223 pure module function spd_get_simplify_factor(this) result(x)
224 class(scatter_plot_data), intent(in) :: this
225 real(real64) :: x
226 x = this%m_simplifyFactor
227 end function
228
229! --------------------
230 module subroutine spd_set_simplify_factor(this, x)
231 class(scatter_plot_data), intent(inout) :: this
232 real(real64), intent(in) :: x
233 this%m_simplifyFactor = x
234 end subroutine
235
236! ------------------------------------------------------------------------------
237 pure module function spd_get_data_dependent_colors(this) result(rst)
238 class(scatter_plot_data), intent(in) :: this
239 logical :: rst
240 rst = this%m_dataDependentColors
241 end function
242
243! --------------------
244 module subroutine spd_set_data_dependent_colors(this, x)
245 class(scatter_plot_data), intent(inout) :: this
246 logical, intent(in) :: x
247 this%m_dataDependentColors = x
248 end subroutine
249
250! ******************************************************************************
251! ADDED: JUNE 28, 2021 - JAC
252! ------------------------------------------------------------------------------
253 pure module function spd_get_filled(this) result(rst)
254 class(scatter_plot_data), intent(in) :: this
255 logical :: rst
256 rst = this%m_filledCurve
257 end function
258
259! --------------------
260 module subroutine spd_set_filled(this, x)
261 class(scatter_plot_data), intent(inout) :: this
262 logical, intent(in) :: x
263 this%m_filledCurve = x
264 end subroutine
265
266! ******************************************************************************
267! ADDED: JAN 12, 2024 - JAC
268! ------------------------------------------------------------------------------
269 pure module function spd_get_use_var_point_size(this) result(rst)
270 class(scatter_plot_data), intent(in) :: this
271 logical :: rst
272 rst = this%m_useVariableSizePoints
273 end function
274
275! --------------------
276 module subroutine spd_set_use_var_point_size(this, x)
277 class(scatter_plot_data), intent(inout) :: this
278 logical, intent(in) :: x
279 this%m_useVariableSizePoints = x
280 end subroutine
281
282! ------------------------------------------------------------------------------
283end submodule
fplot_core