A chart provides a task-specific application programming interface (API) for creating custom visualizations. Designing and implementing a chart not only provides a convenient API for end users, but simultaneously removes the need for the user to manipulate low-level graphics objects.
The toolbox comprises several diverse examples of custom MATLAB charts, together with a catalog app for browsing the available charts.
You can inspect the source code used for each chart, explore the features and functionality of each chart, and run Live Script examples demonstrating the use of each chart. The toolbox also has documentation and resources to help you get started with developing your own charts.
Ken Deeley (2021). Chart Development Toolbox (https://www.mathworks.com/matlabcentral/fileexchange/65857-chart-development-toolbox), MATLAB Central File Exchange. Retrieved .
Nice question. In general, charts maintain their graphics objects privately (i.e., they do not expose their internal graphics to users). This prevents accidental deletion, modification or other unauthorized operations. Unfortunately, as a side effect of this, some convenience functions, such as hold, do not work, since they require access to the chart's axes, which is stored privately.
One solution to your question would be to create a version of ScatterFit which supports 2D matrices for the XData and YData properties, rather than the current implementation which allows XData and YData to be vectors only. Each pair of columns (XData(:, k), YData(:, k)) could then be treated as a separate dataset with its own best-fit line. You could also support the situation where XData is a vector and YData is a matrix, and interpret each column of YData as a dataset to be plotted against the same XData vector. Implementing this would support your requirement - instead of using hold on, the user could just change the XData/YData chart properties. Feel free to have a look at the set.XData, set.YData methods in ScatterFit.
Many thanks for your feedback,
Does the "ScatterFit" function support multiple datasets on the same figure such as a scatter with "hold on"? Thanks.
Many thanks for taking the time to provide feedback. We have seen this issue before with charts developed by our colleagues. The problem is that if the axes' HandleVisibility property is set to "off", then interactive use of the axes' Toolbar is disabled.
ax = axes("HandleVisibility", "off"); % Interactive toolbar use is disabled
ax.HandleVisibility = "on"; % Toolbar use is now available
The reason that we set the HandleVisibility property to "off" in our charts is to prevent the user inadvertently deleting or modifying the chart's graphics objects via another plotting operation. For example, when the plot function is called, the default behavior is to look for the most recent axes available for plotting, then use that axes to create the plot.
As a workaround, you can create the chart's axes with HandleVisibility set to "on", which will give you access to the interactive axes Toolbar. Also, to minimize the risk of inadvertent interference with the chart caused by other plotting operations, you should set the HandleVisibility of your top-level figure containing the chart to "off". (Note that setting the HandleVisibility of the chart's panel to "off" does not solve the problem, because panels do not protect their axes children from unauthorized plotting.)
Thank you for reporting this - we will pass this feedback to our graphics development team for future consideration.
Any idea why the axes toolbar with zoom, pan, data cursor, etc. don't show up when you create one of these charts? Even adding a "axtoolbar(obj.Axes,'default')" command to the constructor doesn't work". Forcing a menubar and toolbar in the exampleFigure function creates the bars... but the buttons don't work. Somehow does the chart class and individual plot classes get rid of this functionality due to the way they are coded?
Well-spotted, thanks for providing the feedback. I have submitted a corrected version which should appear shortly.
The bug in the chart icons still remains. If not all necessary toolboxes are installed some charts are removed from the ChartCatalog (e.g. "Financial Toolbox"). In that case the initialization of the chart icons get messed. To fix this bug I changed the following two lines in the CatalogLauncher class:<br>
line 123: [chartList, ~, indexChart] = intersect( userAccessibleCharts, chartNames );
line 142: "ImageSource", S.ChartTiles(indexChart(k)).Tile, ...
I like the idea of the ChartCatalog and the creation of the documentation as mlx-files including the links to Open the Live script or to view the source code.
I will update the File Exchange entry shortly.
it's clear that you need R2019b for this app but on the file exchange page in MATLAB Release Compatibility the entry is:
Created with R2019b
Compatible with any release
Can you change "Compatible with any release" to at least R2019b.
In the chart catalog the icons on the buttons for the different charts are wrong except for CircularNetFlow Cylinder and EdgeworthBowley. The LineSelector shows the icon of the LineGradient, the Radar shows the icon of the LineSelector, ...
Do you have R2019b installed? The app requires various features from R2019b, including uihtml and the new colororder function referenced in the error message.
when i install your app, i got several errors. Do you know how to solve it?
Error using chartCatalog (line 10)
Invalid default value for property 'DefaultColors' in class 'CatalogLauncher':
Undefined function or variable 'colororder'.
Error in ChartCatalogApp/startApp (line 86)
obj.AppHandle = eval('chartCatalog');
Error in ChartCatalogApp (line 48)
Error in appinstall.internal.runapp>execute (line 116)
out = evalin('caller', [script ';']);
Error in appinstall.internal.runapp>runapp13a (line 95)
outobj = execute(fullfile(appinstalldir, [wrapperfile 'App.m']));
Error in appinstall.internal.runapp>preamble18b (line 60)
appobj = runapp13a(appinstalldir);
Error in appinstall.internal.runapp (line 13)
out = preamble18b(appinstalldir);
Error in matlab.apputil.run (line 45)
Thanks very much for the feedback. Creating a heatmap chart is a great example. You can associate a colormap with an axes as follows.
% Create a figure and an axes.
f1 = figure;
ax = axes(f1);
% Associate a specific colormap to the axes.
% Visualise this by adding a colorbar.
% Next, create a new figure equipped with a different colormap.
f2 = figure('Colormap', summer(64));
% Move the axes to the new figure, then check that the colormaps are preserved.
ax.Parent = f2;
Thank you for this code, it gave me what I needed to get started with some well programmed charts. One comment:
I made a heat-map chart as a way of getting started. I used an Image to present the matrix of numbers and the colormap to set the color representation. However, the colormap is associated with the Figure in Matlab and not an Axes. Consequently, when I change the parent, it take on the colormap of the new figure window. Maybe it would be helpful to make the "parent" property observable, so if it changes I can trigger an "update". It is, however, also possible that I missed something.
Thank you for providing feedback. Further updates to this File Exchange entry are planned. I would be interested to investigate items (1)-(3) with you in more detail. Please email me at <first name> dot <last name> at mathworks dot com with a brief description of the reproduction steps. (4) is fixed for the next release. (5) is a good idea if we release this entry as a toolbox at some point.
A nice ambitious project. It would make me happy to think that this "Chart" object would be continued to be developed.
I have some small issues:
1. The detection of the "GUI Layout Toolbox" does not necessarily work (for me) even though it is installed.
2. The GalleryLauncher misaligns the chart with the image associated with that chart
3. Do you really want to pollute the users name space with your +Data and +Exercise packages (?)
4. Cylinder.mlx contains a saved error
5. Should (or can) this project have the proper MATLAB toolbox parts: help, contents file etc.
Requires GUI Layout Toolbox: https://www.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!