Attributed Plot Html

This exchange file creates a clickable image map for a figure with links to multiple data sources.
401 Downloads
Updated 25 Mar 2013

View License

This exchange file creates a plot of data and an accompanying html imagemap so that a figure can be published on the web that includes clickable links to multiple data sources. It’s useful to fully attribute plotted data, even when a single plot has many sources.

The AttributedPlotHtml.m function creates a png image file of a MatLab plot and an image map with specific pixel locations of each data point. It additionally produces a simple html file that displays the plot with optional links to the data source of each data point. An instructional README file explains how to implement your uniquely created html and png files so you can display them on your webpage.

The function is autonomous, so if it is executed without input arguments it will produce a sample "AttributedData" html page that displays the image and imagemap outputs.

The next simplest execution of the function only requires the Dim2Data input argument, a 2D matrix with x and y data columns. The resulting imagemap and html can be customized, for example with an html editor.

The optional second argument, ImageName, assigns imagename as the title of the png and html files.

Finally, you can include a third argument: the Crux object. The Crux object has many optional fields to populate to make specific content and style selections:
- Recommended Crux Properties:
- Crux.blurbs - Array of strings with length equal to Dim2Data,
- - brief description of data source
- Crux.links - Array of strings with length equal to Dim2Data,
- - link to source of form: "http://www.google.com/"
- Crux.xlab - string with label for x-axis
- Crux.ylab - string with label for y-axis
- Crux.imagewidth - number - width of image in inches (rec:5)
- Crux.imageheight - number - height of image in inches (rec:3)
- Optional Crux Properties:
- Crux.plottitle - string title for plot
- Crux.title - string title for html page
- Crux.linksx - Array of strings with length equal to Dim2Data,
- - link to source of x data (if different than y)
- - of form: "http://www.google.com/"
- Crux.slinkFormat - string for sprintf to represent y data magnitude
- - ex: '%0.0f' for '54' output from 54.367 input
- - ex: '%0.2f' for '54.36' output from 54.367 input
- Crux.slinkxFormat - string for sprintf to represent x data magnitude
- Crux.plotfun - anonymous function that defines plot
- - see help function_handle for use syntax
- - must have only two inputs, xdata and ydata
- Example
- Crux.plotfun = @(xx,yy) plot(xx,yy,'.','MarkerSize',13);

The download includes EXAMPLE_marathons.m which is a sample data file with input fields for AttributedPlotHtml. It creates a race day temp vs. marathon time plot, html file, and png. EXAMPLE_marathons.m is an autonomous code that can be executed without an input argument.

Acknowledgments: This creation of this function was greatly expedited by the code sample by Adam C. Finnefrock http://www.mathworks.com/matlabcentral/newsreader/view_thread/12571
If you are only interested in an image map, makemap.m produces an image map from any plotted figure: http://www.mathworks.com/matlabcentral/fileexchange/3893-save-with-image-map/content/makemap.m

Cite As

Emily Alden (2024). Attributed Plot Html (https://www.mathworks.com/matlabcentral/fileexchange/40948-attributed-plot-html), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0