Skip to content

Commit df9165b

Browse files
Update function plot data
1 parent 27fac2f commit df9165b

4 files changed

Lines changed: 315 additions & 174 deletions

File tree

examples/function_plot_example.f90

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,29 @@ program example
55

66
! Local Variables
77
type(plot_2d) :: plt
8-
type(plot_data_function) :: fcn
8+
type(plot_data_function) :: fcn1, fcn2
9+
class(legend), pointer :: lgnd
910

10-
! Define the function to plot
11-
call fcn%define_data("sin(x)", "f(x)", 0.0d0, 10.0d0)
11+
! Define the functions to plot
12+
call fcn1%define_data("sin(x)", "f(x)", 0.0d0, 10.0d0)
13+
call fcn1%set_line_width(2.0)
14+
15+
call fcn2%define_data("cos(x)", "g(x)", 0.0d0, 7.5d0)
16+
call fcn2%set_line_width(2.0)
17+
call fcn2%set_line_style(LINE_DASHED)
18+
call fcn2%set_draw_markers(.true.)
19+
call fcn2%set_marker_scaling(1.5)
20+
call fcn2%set_marker_frequency(8)
1221

1322
! Plot
1423
call plt%initialize()
15-
call plt%push(fcn)
24+
25+
lgnd => plt%get_legend()
26+
call lgnd%set_is_visible(.true.)
27+
call lgnd%set_draw_border(.false.)
28+
call lgnd%set_vertical_position(LEGEND_BOTTOM)
29+
30+
call plt%push(fcn1)
31+
call plt%push(fcn2)
1632
call plt%draw()
1733
end program

src/fplot_core.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ module fplot_core
139139
public :: pd_get_string_result
140140
public :: pd_clear_action
141141
public :: plot_data_colored
142+
public :: line_plot_data
142143
public :: scatter_plot_data
143144
public :: spd_get_int_value
144145
public :: spd_get_string_result

0 commit comments

Comments
 (0)