polygonplot - Maple Help

Home : Support : Online Help : Graphics : 2-D : polygonplot

plots

 polygonplot
 create a plot of one or more polygons

 Calling Sequence polygonplot(L, options) polygonplot(A, options) polygonplot(v1, v2, options)

Parameters

 L - list of polygon vertices, each given as a two-element list A - n by 2 Matrix, where n is any positive integer v1, v2 - Vectors of the same length options - (optional) equations of the form option=value, where option is any of the available plot options, or useunits

Description

 • The polygonplot command is used to create a 2-D plot of a polygon. The polygon's vertices are provided as the list L, the Matrix A, or the Vectors v1 and v2.
 • The list L must contain 2-element lists or Vectors [x, y], each representing the numeric x- and y-coordinates of a vertex, optionally with units.
 • The Matrix must be n by 2, where n is any positive integer. Each row of the Matrix contains the x- and y-coordinates of a vertex, optionally with units. If a 2 by n Matrix is given, with n not equal to 2, then it will be automatically transposed. The Vectors, representing the x-coordinates and the y-coordinates of the vertices respectively, again optionally with units, can have any length, but both must have the same length.
 • The option useunits=[ux, uy] specifies the units to be used on the horizontal and vertical axis, respectively. By default, Maple picks a suitable unit of a dimension appropriate for the data. It is typically the units given for the first point. All data are converted to this unit and the unit is used as the label for the axis, unless labels are specified using the labels option. (See plot/options for the labels option.) If you want to specify the unit for one of the axes and let Maple pick the other, you can specify the one you don't want to choose as "default" or default. If not all values given for a particular coordinate axis can be converted to the appropriate unit (specified or default), Maple issues an error.
 • If you have a very large number of points, it is recommended that you provide the data as a Matrix with datatype set to float.
 • Remaining arguments are interpreted as options which are specified as equations of the form option = value. These options are the same as those available for the plot command, as described in plot options.
 • Multiple polygons can be plotted by providing a list containing polygons in the list or Matrix form, as described above. In this case, the color option value can be a list of n colors, where n is the number of polygons.

Examples

 > $\mathrm{with}\left(\mathrm{plots}\right):$
 > $\mathrm{ngon}≔n↦\left[\mathrm{seq}\left(\left[\mathrm{cos}\left(\frac{2\cdot \mathrm{\pi }\cdot i}{n}\right),\mathrm{sin}\left(\frac{2\cdot \mathrm{\pi }\cdot i}{n}\right)\right],i=1..n\right)\right]:$
 > $\mathrm{display}\left(\left[\mathrm{polygonplot}\left(\mathrm{ngon}\left(8\right),\mathrm{color}=\mathrm{blue}\right),\mathrm{textplot}\left(\left[0,0,\mathrm{Octagon}\right]\right)\right],\mathrm{axes}=\mathrm{none}\right)$
 > $\mathrm{one_poly}≔\mathrm{Matrix}\left(\left[\left[0,0\right],\left[0,1\right],\left[0.5,0.5\right],\left[1,1\right],\left[1,0.05\right],\left[0.95,0.05\right],\left[0.95,0\right]\right],\mathrm{datatype}=\mathrm{float}\right):$
 > $\mathrm{polygonplot}\left(\mathrm{one_poly},\mathrm{axes}=\mathrm{boxed},\mathrm{colour}="Magenta",\mathrm{transparency}=0.7,\mathrm{gridlines}\right)$

The command to create the plot from the Plotting Guide is

 > $\mathrm{poly}≔\left[\left[0,1\right],\left[0,2\right],\left[0.5,2.75\right],\left[1.25,3\right],\left[2,2.75\right],\left[2.5,2.25\right],\left[1.75,1.5\right],\left[2.5,0.75\right],\left[2,0.25\right],\left[1.25,0\right],\left[0.5,0.25\right]\right]$
 ${\mathrm{poly}}{≔}\left[\left[{0}{,}{1}\right]{,}\left[{0}{,}{2}\right]{,}\left[{0.5}{,}{2.75}\right]{,}\left[{1.25}{,}{3}\right]{,}\left[{2}{,}{2.75}\right]{,}\left[{2.5}{,}{2.25}\right]{,}\left[{1.75}{,}{1.5}\right]{,}\left[{2.5}{,}{0.75}\right]{,}\left[{2}{,}{0.25}\right]{,}\left[{1.25}{,}{0}\right]{,}\left[{0.5}{,}{0.25}\right]\right]$ (1)
 > $\mathrm{polygonplot}\left(\mathrm{poly},\mathrm{axes}=\mathrm{boxed},\mathrm{color}="DarkGreen",\mathrm{transparency}=0.5\right)$

The style option controls how the polygon is drawn.  In the next example, the same polygon is drawn without the border.

 > $\mathrm{polygonplot}\left(\mathrm{poly},\mathrm{axes}=\mathrm{boxed},\mathrm{color}="DarkGreen",\mathrm{transparency}=0.5,\mathrm{style}=\mathrm{polygon}\right)$

This example shows how you can use the useunits option. For investigating a refrigeration cycle, it can be useful to draw a quadrangle on a P-h-T chart. (See this analysis for more background.) The coordinates of this quadrangle would normally result from a command, so they may not be in the same units as the P-h-T chart.

 > $\mathrm{point_data}≔\left[\left[386461.5358\mathrm{Unit}\left(\frac{J}{\mathrm{kg}}\right),131876.9284\mathrm{Unit}\left(\mathrm{Pa}\right)\right],\left[451844.2441\mathrm{Unit}\left(\frac{J}{\mathrm{kg}}\right),1000000\mathrm{Unit}\left(\mathrm{Pa}\right)\right],\left[241499.5190\mathrm{Unit}\left(\frac{J}{\mathrm{kg}}\right),1000000\mathrm{Unit}\left(\mathrm{Pa}\right)\right],\left[241499.5190\mathrm{Unit}\left(\frac{J}{\mathrm{kg}}\right),131876.9284\mathrm{Unit}\left(\mathrm{Pa}\right)\right]\right]:$
 > $\mathrm{pht_chart}≔\mathrm{ThermophysicalData}:-\mathrm{PHTChart}\left(\mathrm{R134a},100\mathrm{Unit}\left(\mathrm{kPa}\right)..4100\mathrm{Unit}\left(\mathrm{kPa}\right)\right)$
 > $\mathrm{quadrangle}≔\mathrm{polygonplot}\left(\mathrm{point_data},\mathrm{color}="DarkRed",\mathrm{thickness}=5,\mathrm{style}=\mathrm{line},\mathrm{useunits}=\left[\frac{\mathrm{kJ}}{\mathrm{kg}},\mathrm{kPa}\right]\right)$
 > $\mathrm{display}\left(\mathrm{pht_chart},\mathrm{quadrangle}\right)$