Can't change line style from plot browser in R2014b

2 次查看(过去 30 天)
I recently updated from R2012b to R2014b, and I'm having trouble with the plot browser and property editor for figures in R2014b. I have a figure with multiple curves (objects) that I made using a script. When I select one of the curves from the plot browser and change the line style (i.e solid line to dashed line) or change the marker using the property editor, the changes are not made. The drop-down boxes for "Line" and "Marker" are changed, but the curve itself is not changed. If I click somewhere else on the figure and then re-select the same curve, the old line style and marker settings are in the property editor. I can, however, change the line color and the line width from the property editor. My current work-around is to open the figure in my old copy of R2012b, change the line style and marker, save the figure, and then open it back in R2014b. This works, but it is not a long-term solution. Is this a bug with the new graphics in R2014b, or is there a setting I need to change in the new version of Matlab?

回答(1 个)

Prateekshya
Prateekshya 2024-10-7
Hello Elizabeth,
The issue you are encountering with MATLAB R2014b likely stems from changes in the graphics system introduced in this version. R2014b marked a significant update to MATLAB's graphics system, transitioning to the new "HG2" graphics engine, which may have introduced some unexpected behavior in the property editor, especially when handling line styles and markers.
Here are a few steps and suggestions to address the issue:
  • Ensure you have installed the latest updates or patches for MATLAB R2014b.
  • As a workaround, you can manually change the line style and markers through the command line. For example, if you have a handle to a plot line:
h = findobj(gca, 'Type', 'line'); % Find all line objects in the current axes
% Loop through each line and set properties
for i = 1:length(h)
set(h(i), 'LineStyle', '--'); % Change line style to dashed
set(h(i), 'Marker', 'o'); % Change marker to circle
end
  • If you need to modify specific lines and you know their properties (e.g., color, line width), you can use findobj to identify them:
h = findobj(gca, 'Type', 'line', 'Color', [1 0 0]); % Find red lines
set(h, 'LineStyle', '--', 'Marker', 'o'); % Apply changes
  • Ensure there are no callbacks or listeners that reset properties when the figure is updated.
  • Try using the plottools command to open a more comprehensive graphical interface for editing plot properties:
plottools;
  • If you have customized graphics settings, try resetting them to default:
set(0, 'DefaultLineLineStyle', '-'); % Reset default line style
set(0, 'DefaultLineMarker', 'none'); % Reset default marker
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Data Exploration 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by