Basic Examples
Basic Examples
Create a polygon object of type:
"Diamond"
In[]:=
pd=["Diamond"]
Out[]=
Polygon
In[]:=
Graphics[pd]
Out[]=
Get the complete list of built-in named shapes:
In[]:=
allShapes=[All]
Out[]=
{TripleCross,Y,UpTriangle,UpTriangleTruncated,DownTriangle,DownTriangleTruncated,LeftTriangle,LeftTriangleTruncated,RightTriangle,RightTriangleTruncated,ThreePointedStar,Cross,DiagonalCross,Diamond,Square,FourPointedStar,DiagonalFourPointedStar,FivefoldCross,Pentagon,FivePointedStar,FivePointedStarThick,SixfoldCross,Hexagon,SixPointedStar,SixPointedStarSlim,SevenfoldCross,SevenPointedStar,SevenPointedStarNeat,SevenPointedStarSlim,EightfoldCross,Disk,H,I,N,Z,S,Sw,Sl}
Make a of buttons with the shapes for easy selection:
In[]:=
Grid{allShapes[[;;11]],allShapes[[12;;17]],allShapes[[18;;21]],allShapes[[22;;31]],allShapes[[32;;]]}/.shape_String:>ButtonTooltipGraphicsFaceForm[Hue@Random[]],EdgeForm[{Black,Thickness[0.003],JoinForm["Miter"]}],[shape],ImageSize40,PlotRange1.5,PlotRangePadding0,ImagePadding0,Row[{"\"",Style[shape,Bold],"\""," (click to copy the name)"}],CopyToClipboard@InputForm[shape]
Out[]=
| | | | | ||||||
| | | | | | | ||||
| ||||||||||
| | | |
Filled markers which picks up the automatically:
In[]:=
fm[name_String,size_:8]:=GraphicsEdgeForm[],[name,Offset[size]];SeedRandom[25]ListPlot[Table[Accumulate@RandomReal[1,10]+i,{i,6}],PlotMarkersfm/@{"Triangle","Y","Diamond","ThreePointedStar","FivePointedStar","TripleCross"},JoinedTrue,PlotStyleColorData[54,"ColorList"],PlotLegendsPointLegend[Automatic,LegendMarkerSize{30,25}],ImageSize450]
Out[]=
Empty markers which picks up the automatically:
em[name_String,size_:7]:=GraphicsDynamic@EdgeForm@Directive[CurrentValue["Color"],JoinForm["Round"],AbsoluteThickness[2],Opacity[1]],FaceForm[White],[name,Offset[size]]SeedRandom[2]ListPlot[Table[Accumulate@RandomReal[1,10]+i,{i,3}],PlotMarkersem/@{"Triangle","Square","Diamond"},JoinedTrue,PlotLegendsPointLegend[Automatic,LegendMarkerSize{40,25}],ImageSize450]
Out[]=
Filled markers with lighter filling colors:
fm2[name_String,size_:9]:=GraphicsDynamic@EdgeForm[CurrentValue["Color"]],Dynamic@FaceForm@Lighter[CurrentValue["Color"],0.75],[name,Offset@size]data=Table[{x,BesselJ[k,x]},{k,0,2},{x,0,10,0.5}];ListPlot[data,PlotMarkersfm2/@{"UpTriangle","Square","Circle"},JoinedTrue,FrameTrue,AxesFalse,ImageSize450,PlotRangePadding{Scaled[.05],Scaled[.1]}]
Out[]=
Scope
Scope
Use the third argument of to specify the coordinate(s) where the marker should be placed:
PolygonMarker
GraphicsFaceForm[],EdgeForm[{Black,AbsoluteThickness[1],JoinForm["Miter"]}],["Circle",Offset[7],RandomReal[{-1,1},{20,2}]],["ThreePointedStar",Offset[7],RandomReal[{-1,1},{20,2}]],["FourPointedStar",Offset[7],RandomReal[{-1,1},{20,2}]],["FivePointedStar",Offset[7],RandomReal[{-1,1},{20,2}]],AspectRatio12,ImageSize450
Neat Examples
Neat Examples
Show a set of markers in use, including some created from glyphs:
Here is a plot where the symbols significantly overlap: