-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgeneric_3d_plot.f90
More file actions
44 lines (33 loc) · 950 Bytes
/
Copy pathgeneric_3d_plot.f90
File metadata and controls
44 lines (33 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
program example
use, intrinsic :: iso_fortran_env
use fplot_core
implicit none
! Parameters
integer(int32), parameter :: n = 1000
! Local Variables
real(real64), dimension(n) :: t, x, y, z
type(plot_3d) :: plt
type(plot_data_3d) :: d1
class(plot_axis), pointer :: xAxis, yAxis, zAxis
! Initialize the plot object
call plt%initialize()
! Define titles
call plt%set_title("Example Plot")
xAxis => plt%get_x_axis()
call xAxis%set_title("X Axis")
yAxis => plt%get_y_axis()
call yAxis%set_title("Y Axis")
zAxis => plt%get_z_axis()
call zAxis%set_title("Z Axis")
! Define the data
t = linspace(0.0d0, 10.0d0, n)
x = cos(5.0d0 * t)
y = sin(5.0d0 * t)
z = 2.0d0 * t
call d1%define_data(x, y, z)
call d1%set_line_width(2.0)
! Add the data to the plot
call plt%push(d1)
! Let GNUPLOT draw the plot
call plt%draw()
end program