vastmanage.blogg.se

Get aplot from approximatrix simply fortran
Get aplot from approximatrix simply fortran









get aplot from approximatrix simply fortran
  1. #Get aplot from approximatrix simply fortran code
  2. #Get aplot from approximatrix simply fortran series
  3. #Get aplot from approximatrix simply fortran windows

The complete code for this example is below: program ranmeanĬall set_title(plot, "Uniform Random Numbers")Ĭall set_seriestype(plot, 0, APLOT_STYLE_PIXEL) Any questions about how it works can always be posted on our forums, where either Approximatrix or another user will happily help out. The interface is designed for quickly and easily adding plots to Fortran. Hopefully the above helps users get started with Aplot. The plot shows the running average, in blue, converging towards 0.5 as more samples are considered.

get aplot from approximatrix simply fortran

While the plot might look slightly different on macOS or Windows, it should still resemble the above chart. The code here should compile in Simply Fortran 2.36 without issue, generating the following on GNU/Linux: The simple code is: call destroy_plot(plot)Īfter this call, all memory associated with the plot is released, and the program can continue normally. While not necessarily important in a standalone program, a subroutine that generates plots should always perform final cleanup before exiting.

get aplot from approximatrix simply fortran

The final coding step is to clean up our plot after the user closes it.

get aplot from approximatrix simply fortran

Which opens a window displaying the complete plot. The final step is to call: call display_plot(plot) Our plot is now entirely ready to display. Our second dataset, the running average, can be configured similarly: call add_dataset(plot, x, mean_y)Ĭall set_seriestype(plot, 1, APLOT_STYLE_LINE)Ĭall set_serieslabel(plot, 1, "Running Mean")

#Get aplot from approximatrix simply fortran series

The second call to set_serieslabel provides a label for this series in the legend. In this case, since we’ll be showing 1000 points, we’ve asked for it to be drawn as a scatter plot using single pixels the user can also use larger dots, lines, or bars to represent a series. The index of zero is passed because Aplot uses 0-indexing for its series identification. The call to set_seriestype configures the style of the series when drawn. Once we’ve provided the first dataset to the plot, we can assign some attributes to the series: call set_seriestype(plot, 0, APLOT_STYLE_PIXEL)Ĭall set_serieslabel(plot, 0, "Random Number") To add data, we must pass an X and Y array to the add_dataset subroutine: call add_dataset(plot, x, rand_y) The next step is to configure each dataset for the plot. In order to provide a little extra space, we’ll expand the plot slightly so that the y-axis varies from 0 to 1.2. In this case, though, we know the data on the y-axis will fall between 0 and 1. The final call, though, to set_yscale might not be as obvious as setting titles and labels. Most calls above are straightforward, and each requires our plot variable as its first argument. Once initialized, we can define some aspects of our plot: call set_title(plot, "Uniform Random Numbers") Before we can use it, though, we must initialize it: plot = initialize_plot() This variable is used for defining all aspects of our plot at eventually displaying it. In order to create a plot, we need to define a plot variable, which is of the aplot_t type: type(aplot_t)::plot This code generates two datasets that we need to plot. The x array is manually populated inside the loop along with the calculation of a running mean in the mean_y array. The random data is created with a single call to RANDOM_NUMBER, which populates the entire rand_y array in one call. Our X-axis data will just be the sample count, though we have to use a REAL variable with Aplot. The code below should be sufficient: real, dimension(1000)::x, rand_y, mean_y To generate our data set, we’ll need to populate some arrays accordingly. There are no other steps to take Simply Fortran will automatically detect this module’s inclusion and configure the compiler to link to the aplot library. On GNU/Linux, Simply Fortran might show the module as unavailable until you click Build Project for the first time.

#Get aplot from approximatrix simply fortran windows

On Windows and macOS, this module will be seamlessly included. In order to use Aplot, the aplot module must be employed in a given procedure: use aplot The plot will therefore include scatter elements and a line, both with a significant amount of data. This short article will walk through creating a non-trivial plot quickly with Aplot.įor this example, we’ll attempt to plot 1000 random, uniformly distributed numbers along with a running mean as the sample size grows. The programming interface provided is designed to be straightforward, and the library is available on Windows, macOS, and GNU/Linux. With the release of version 2.36, Simply Fortran now includes Aplot, a library for creating simple, two-dimensional plots and charts directly from Fortran. Introducing Aplot Posted: Ap| Author: approximatrix | Filed under: Aplot, Tips and Tricks | Leave a comment











Get aplot from approximatrix simply fortran