matlab
Written by Daniel Herber on June 14, 2019.
What marker specifier results in the smallest file size when saved as a PDF? The answer is an unfilled square.
---
### Marker Specifiers
There are 13 marker specifiers defined in the MATLAB line specification documentation [[link]](https://www.mathworks.com/help/matlab/ref/linespec.html).
Note that markers have both a ```MarkerEdgeColor``` and ```MarkerFaceColor``` property.
When the face color is omitted, the filled area is transparent and has a smaller byte size.
Therefore, both filled and unfilled markers will be tested.
Listed out, they are:
```matlab
% complete marker specifier list
markers = {'+','o','*','.','x','s','d','^','v','>','<','p','h'};
```
[![markers.png](blogs/matlab/post_9/markers.png)](blogs/matlab/post_9/markers.png){data-lightbox="blog_imgs" data-title="All 13 markers (both unfilled and filled)"}
The simple question that is investigated in this post is what marker specifier results in the smallest file size when saved as a PDF?
To answer this question, we will simply generate, plot, and save some random data using all the different marker specifiers.
---
### Results
The results are summarized in the images below and some comments are at the end of this section.
This first plot was created using 1,000 randomly generated points with each marker specifier.
[![results.png](blogs/matlab/post_9/results.png)](blogs/matlab/post_9/results.png){data-lightbox="blog_imgs" data-title="Results with 1,000 points"}
This second plot was created using 100,000 randomly generated points with each marker specifier, but now we show the byte size ration relative to the specifier with the smallest size.
[![results-ratio.png](blogs/matlab/post_9/results-ratio.png)](blogs/matlab/post_9/results-ratio.png){data-lightbox="blog_imgs" data-title="Results with 100,000 points"}
#### Comments
- An unfilled square is the winner. Even the filled square is significantly better than the other specifiers.
- Surprisingly, the simple dot is the least space efficient. It requires 11x space that the unfilled square!
- The unfilled and filled circles are more favorable than the simple dot, but not by much.
- There are some minor differences in the orderings between results with 1,000 and 100,000 points.
---
### Code
The code for this post is available at [[link]](blogs/matlab/post_9/post_9.m).
Please note that you need to have [export_fig](https://github.com/altmany/export_fig) to run the code.