4
$\begingroup$

Is it possible to import a vector file & use as a symbol / plotmarker? I tried importing an EPS from Illustrator & assigning a name to it, but it failed. I would really like to be able to use it as a graphics primitive, and create designs by placing them in exact positions / scaling, etc.. Is there a file size limitation?

Mathematica has a load of special characters like [\BlackKing], etc. which are presumably .ttf files. Is it possible to add to this library?

$\endgroup$
2
  • 1
    $\begingroup$ \[BlackKing] is a character, so the last part is like asking if you can use your own custom font and the answer is that Mathematica doesn't care which font you use as long as it's installed on the system. See Chess symbols in Unicode. As for custom plotmarkers this should certainly be possible, as evidenced by the documentation. I don't know where you went wrong but might be able to figure it out if you post an example. For the third question about placing objects within a graphics object, Inset comes to mind. $\endgroup$
    – C. E.
    May 6, 2015 at 19:50
  • $\begingroup$ @Pickett thanks - will try to post an eg - thanks for the extra info too :) $\endgroup$
    – martin
    May 6, 2015 at 19:53

1 Answer 1

5
$\begingroup$

Yes, I think you can, using the PlotMarkers -> {graphic, size} option to the plotting functions. See the documentation for PlotMarkers here for the details.

For instance, let's generate a colored pentagon, export it as an EPS file, and re-import it from that file:

Export["pentagon.eps", 
 Graphics[{EdgeForm[{Thickness[0.05], Darker@Green}], 
   FaceForm[{Green, Opacity[0.1]}], Polygon[CirclePoints[5]]}]];

pentmark = Import["pentagon.eps"];

ListPlot[
 Table[{i, 2 i}, {i, -9, 9, 3}],
 Axes -> False, Frame -> True, 
 PlotRangePadding -> Scaled[0.1], AspectRatio -> 1,

 PlotMarkers -> {pentmark, 0.1} (* here's where you choose the markers *)

]

ListPlot with arbitrary markers

Update on CirclePoints[]:

@martin pointed out that CirclePoints is new in version 10. The following function provides the same functionality:

circlepoints[n_] := Table[{Sin[2 Pi k/n], Cos[2 Pi k/n]}, {k, 0, n - 1}]
$\endgroup$
10
  • $\begingroup$ CirclePoints isn't built into mine, though Polygon[Table[{Cos[2 \[Pi] k/6], Sin[2 \[Pi] k/6]}, {k, 0, 5}]] works for me. $\endgroup$
    – martin
    May 6, 2015 at 19:55
  • $\begingroup$ This works great, but when I try with my Illustrator eps Import["C:\\Users.....\\splat.eps"] it doesn't work ... $\endgroup$
    – martin
    May 6, 2015 at 20:01
  • 1
    $\begingroup$ @martin That's an excellent point. I had not realized that CirclePoints was that new. I'll add your alternative to the answer. $\endgroup$
    – MarcoB
    May 6, 2015 at 20:04
  • 1
    $\begingroup$ If the simple Import is failing that's really separate question. Do a search if folks have had issues with Illustrator/Eps and maybe post an example file. $\endgroup$
    – george2079
    May 6, 2015 at 20:13
  • 1
    $\begingroup$ @martin I think it is possible to do that. As a matter of fact, I think that's what we did here, in a way! However, the internal representation of my re-imported pentagon is not a Polygon primitive anymore: Import re-interpreted it as the superposition of two other graphics primitives, a JoinedCurve and a FilledCurve. You can inspect the structure of the imported objects using e.g. InputForm[ object ] to see what the internal representation is. $\endgroup$
    – MarcoB
    May 6, 2015 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.