Nplot Examples

Posted By admin On 02/04/22

NPlot was designed to let science teachers teach science instead of how to wrestle with different graphing programs. For example, uncertainties can simply be entered in the columns labeled '± x' and '± y'. NPlot has become my new main web charting squeeze because it gives me more control over the chart surface area, plotting behaviour, etc. Carlos Aguilar’s component is quick and simple and will still be useful for basic web charting, but NPlot is the more sophisticated alternative. Examples Unfortunately, a detailed C# or VB.NET example of NPlot usage is out of the scope of this short article. Instead, refer to the NPlot website or the demo provided with the distribution. Figure 2 provides some examples of the types of output achievable using NPlot. Charting library for.NET. Contribute to mhowlett/nplot development by creating an account on GitHub. I want to use the nPlot function in RCharts to plot percentages of people falling into discrete groups, rather than frequencies. For example: Using the HairEyeColor data/code below I am able to consider the percentage of people with different hair colors (my grouping variable), as a function of their eye color.

ClassDescription
AdapterUtils Encapsulates functionality relating to exposing data in various different data structures in a consistent way.
AdapterUtils.AxisSuggester_Auto Provides default axis if only data corresponding to orthogonal axis is provided.
AdapterUtils.AxisSuggester_DataView Provides axis suggestion for data in a particular column of a DataView.
AdapterUtils.AxisSuggester_IList This class gets an axis suitable for plotting the data contained in an IList.
AdapterUtils.AxisSuggester_MultiColumns Implements functionality for suggesting an axis suitable for charting data in multiple columns of a DataRowCollection.
AdapterUtils.AxisSuggester_Null This class is responsible for supplying a default axis via the IAxisSuggester interface.
AdapterUtils.AxisSuggester_RowAuto Provides default axis if only data corresponding to orthogonal axis is provided.
AdapterUtils.AxisSuggester_Rows Provides axis for data in a given column of a DataRowCollection.
AdapterUtils.AxisSuggester_StartStep This class gets an axis corresponding to a StartStep object. The data on the orthogonal axis is of course also needed to calculate this.
AdapterUtils.Counter_DataView Class that provides the number of items in a DataView via the ICounter interface.
AdapterUtils.Counter_IList Class that provides the number of items in an IList via the ICounter interface.
AdapterUtils.Counter_Null Class that returns 0 via the ICounter interface.
AdapterUtils.Counter_Rows Class that provides the number of items in a DataRowCollection via the ICounter interface.
AdapterUtils.DataGetter_Count Provides the natural numbers (and 0) via the IDataGetter interface.
AdapterUtils.DataGetter_DataView Provides data in a DataView via the IDataGetter interface.
AdapterUtils.DataGetter_DoublesArray Provides data in an array of doubles via the IDataGetter interface.
AdapterUtils.DataGetter_IList Provides data in an IList via the IDataGetter interface.
AdapterUtils.DataGetter_MultiRows Gets data
AdapterUtils.DataGetter_Null Provides no data.
AdapterUtils.DataGetter_Rows Provides data in a DataRowCollection via the IDataGetter interface.
AdapterUtils.DataGetter_StartStep Provides data points from a StartStep object via the IDataGetter interface.
ArrowItem An Arrow IDrawable, with a text label that is automatically nicely positioned at the non-pointy end of the arrow. Future feature idea: have constructor that takes a dataset, and have the arrow know how to automatically set it's angle to avoid the data.
AxesConstraint Classes derived from this abstract base class define and can apply some form of constraint to the positioning and length of one or more of the four axes of a PlotSurface2D.
AxesConstraint.AspectRatio Defines an axes constraint that forces the world width and height pixel lengths to be at the provided ratio. For example, an aspect ratio of 3:2 or 1.5 indicates that there should be 1.5 times as many pixels per fixed world length along the x direction than for the same world length along the y direction. In other words, the world length of one pixel along the x direction is 2/3rds that of the world length of one pixel height in the y direction.
AxesConstraint.AxisPosition Defines an AxisConstraint that forces the specified axis to be placed at a specific physical position. The position of the axis opposite is held constant.
AxesConstraint.XPixelWorldLength Defines an AxisConstraint that forces the world length corresponding to one pixel on the bottom x-axis to be a certain value. TODO: Allow the pixel world length to be set for the top axis.
AxesConstraint.YPixelWorldLength Defines an AxisConstraint that forces the world length corresponding to one pixel on the left y-axis to be a certain value. TODO: Allow the pixel world length to be set for the right axis.
Axis Encapsulates functionality common to all axis classes. All specific axis classes derive from Axis. Axis can be used as a concrete class itself - it is an Axis without any embilishments [tick marks or tick mark labels].
This class encapsulates no physical information about where the axes are drawn.
BarPlot Draws
BasePlot Supplies implementation of basic legend handling properties, and basic data specifying properties which are used by all plots.
BaseSequencePlot Adds additional basic functionality to BasePlot that is common to all plots that implement the ISequencePlot interface.
CandlePlot Encapsulates functionality for drawing finacial candle charts.
CandlePlot.CandleDataAdapter This class is responsible for interpreting the various ways you can specify data to CandlePlot objects
CandlePlot.CandleStyle
CandlePlot.Stick
DateTimeAxis The DateTimeAxis class
FilledRegion A quick and dirty Filled region plottable object
Grid Encapsulates a Grid IDrawable object. Instances of this to a PlotSurface2D instance to produce a grid.
HistogramPlot Provides ability to draw histogram plots.
HorizontalLine Encapsulates functionality for drawing a horizontal line on a plot surface.
ImagePlot Encapsulates functionality for plotting data as a 2D image chart.
LabelAxis Allows the creation of axes with any number of user defined labels at user defined world values along the axis.
LabelPointPlot Encapsulates functionality
Legend Legend functionality specific to Legends associated with a PlotSurface2D.
LegendBase Provides functionality for drawing legends.
LinearAxis Provides functionality for drawing axes with a linear numeric scale.
LinearGradient Class for creating a linear gradient.
LinePlot Encapsulates functionality for plotting data as a line chart.
LogAxis The class implementing logarithmic axes.
Marker Encapsulates functionality relating to markers used by the PointPlot class.
MarkerItem Class for placement of a single marker.
NPlotException All exceptions thrown by NPlot are of this type.
PageAlignedPhysicalAxis The bare minimum needed to do world->physical and physical->world transforms for vertical axes. Also includes tick placements. Built for speed.
PhysicalAxis This class adds physical positioning information [PhysicalMin, PhysicalMax] and related functionality on top of a specific Axis class. It's an interesting question where to put this information. It belongs with every specific axis type, but on the other hand, users of the library as it is normally used should not see it because positioning of axes is handled internally by PlotSurface2D. Therefore it doesn't make sense to put it in the Axis class unless it is internal. But if this were done it would restrict use of this information outside the library always, which is not what is wanted. The main disadvantage with the method chosen is that there is a lot of passing of the positional information between physical axis and the underlying logical axis type. C# doesn't have templates. If it did, I might derive PhysicalAxis from the templated Axis type (LinearAxis etc). Instead, have used a has-a relationship with an Axis superclass.
PiAxis Axis with labels in multiples of Pi. Maybe needs a better name. Lots of functionality still to be added - currently only puts labels at whole increments of pi, want arbitrary increments, automatically determined and dependance on physical length. Volunteers?
PlotSurface2D Implements the surface on which IDrawables are drawn. Is extended by Bitmap.PlotSurface2D, Windows.PlotSurface2D etc. TODO: better explanation.
PointOLHC Encapsulates open, low, high and close values useful for specifying financial data over a time period, together with a [single] x-value indicating the time [period] the data corresponds to.
PointPlot Encapsulates functionality for drawing data as a series of points.
RectangleBrushes Collection of useful brushes.
RectangleBrushes.Horizontal A brush with horizontal gradient.
RectangleBrushes.HorizontalCenterFade A brush with horizontal gradient that fades into center then out again.
RectangleBrushes.Solid A solid brush
RectangleBrushes.Vertical A brush with vertical gradient.
RectangleBrushes.VerticalCenterFade Brush with vertical gradient that fades into center then out again.
SequenceAdapter This class is responsible for interpreting the various ways you can specify data to plot objects using the DataSource, DataMember, ordinateData and AbscissaData properties. It is a bridge that provides access to this data via a single interface.
StartStep Encapsulates a Start and Step value. This is useful for specifying a regularly spaced set of abscissa values.
StepGradient Class for creating a rainbow legend.
StepPlot Encapsulates functionality for plotting data as a stepped line.
TextItem This class implements drawing text against two physical axes.
TradingDateTimeAxis Provides a DateTime axis that removes non-trading days.
Transform2D Encapsulates functionality for transforming world to physical coordinates optimally.
Transform2D.DefaultTransform2D This class does world -> physical transforms for the general case
Transform2D.FastTransform2D This class does highly efficient world->physical and physical->world transforms for linear axes.
VerticalLine Encapsulates functionality for drawing a vertical line on a plot surface.

This example shows how to use an output function for particleswarm. The output function plots the range that the particles occupy in each dimension.

An output function runs after each iteration of the solver. For syntax details, and for the data available to an output function, see the particleswarm options reference pages.

Custom Plot Function

This output function draws a plot with one line per dimension. Each line represents the range of the particles in the swarm in that dimension. The plot is log-scaled to accommodate wide ranges. If the swarm converges to a single point, then the range of each dimension goes to zero. But if the swarm does not converge to a single point, then the range stays away from zero in some dimensions.

Copy the following code into a file named pswplotranges.m on your MATLAB® path. The code sets up nplot subplots, where nplot is the number of dimensions in the problem.

Objective Function

Nplot Examples

The multirosenbrock function is a generalization of Rosenbrock's function to any even number of dimensions. It has a global minimum of 0 at the point [1,1,1,1,...].

Set Up and Run Problem

Set the multirosenbrock function as the objective function. User four variables. Set a lower bound of -10 and an upper bound of 10 on each variable.

Set options to use the output function.

Set the random number generator to get reproducible output. Then call the solver.

Examples

Results

The solver returned a point near the optimum [1,1,1,1]. But the span of the swarm did not converge to zero.

Nplot

Plot Examples In Literature

Plot examples sentences

Plot Examples For Middle School

Related Topics