Adjust the width of the black line in bubblelegend

조회 수: 54 (최근 30일)
Sim
Sim 2025년 12월 9일 15:38
댓글: Walter Roberson 2025년 12월 11일 19:56
How can I adjust the black line width in bubblelegend?
In the example below, I would like to increase the thickness of the black line that connects the number "88" to the number "486."
x = 1:10;
y = exp(-0.5*x) + .05 * randn(1,10);
sz = randi([20 500],[1,10]);
bubblechart(x,y,sz)
bubblelegend('Population')
  댓글 수: 4
DGM
DGM 2025년 12월 10일 16:54
편집: DGM 2025년 12월 10일 16:55
Well, those properties do exist, but you're prevented from acessing them.
x = 1:10;
y = exp(-0.5*x) + .05 * randn(1,10);
sz = randi([20 500],[1,10]);
bubblechart(x,y,sz)
hl = bubblelegend('Population');
struct(hl) % there are axle width properties and a (linestrip) axle object available
Warning: Calling STRUCT on an object prevents the object from hiding its implementation details and should thus be avoided. Use DISP or DISPLAY to see the visible public details of an object. See 'help struct' for more information.
Warning: The EraseMode property is no longer supported and will error in a future release.
ans = struct with fields:
NumBubbles: 3 NumBubblesMode: 'manual' NumBubbles_I: 3 Style: 'vertical' StyleMode: 'manual' Style_I: 'vertical' BubbleSizeOrder: 'descending' BubbleSizeOrderMode: 'manual' BubbleSizeOrder_I: 'descending' LimitLabels: {3×1 cell} LimitLabelsMode: 'auto' LimitLabels_I: {3×1 cell} Padding: 8 AxleWidth: 5 AxlePadding: 5 AxleIsUsed: 1 BubbleSizes: [50 40 10] BubbleColor: [0 0 0] Location: 'northeast' LocationMode: 'auto' Location_I: 'northeast' NeutralColor: [0.4000 0.4000 0.4000] DefaultBubbleLineWidth: 0.5000 BubbleLineWidth: 0.5000 BubbleEdgeColor: [0 0 0] BubbleAlpha: 1 PrintSettingsCache: [1×1 struct] BubbleContainer: [1×1 Marker] BubbleContainerMode: 'auto' BubbleContainer_I: [1×1 Marker] Axle: [1×1 LineStrip] Bubbles: [1×1 Marker] LabelBig: [1×1 Text] LabelMedium: [1×1 Text] LabelSmall: [1×1 Text] Camera: [1×1 Camera2D] CameraMode: 'auto' Camera_I: [1×1 Camera2D] DataSpace: [1×1 UniformCartesianDataSpace] DataSpaceMode: 'auto' DataSpace_I: [1×1 UniformCartesianDataSpace] ColorSpace: [1×1 MapColorSpace] ColorSpaceMode: 'auto' ColorSpace_I: [1×1 MapColorSpace] DecorationContainer: [1×1 Group] DecorationContainerMode: 'auto' DecorationContainer_I: [1×1 Group] BoxEdge: [1×1 LineLoop] BoxEdgeMode: 'auto' BoxEdge_I: [1×1 LineLoop] BoxFace: [1×1 Quadrilateral] BoxFaceMode: 'auto' BoxFace_I: [1×1 Quadrilateral] Title: [1×1 Text] TitleMode: 'auto' Title_I: [1×1 Text] SelectionHandle: [1×1 ListOfPointsHighlight] SelectionHandleMode: 'auto' SelectionHandle_I: [1×1 ListOfPointsHighlight] TitleSeparator: [1×1 LineStrip] TitleSeparatorMode: 'auto' TitleSeparator_I: [1×1 LineStrip] Axes: [1×1 Axes] AxesMode: 'manual' Axes_I: [1×1 Axes] AxesListenerList: [1×5 event.listener] AxesListenerListMode: 'manual' AxesListenerList_I: [1×5 event.listener] Box: on BoxMode: 'auto' Box_I: on Color: [1 1 1] ColorMode: 'auto' Color_I: [1 1 1] EdgeColor: [0.1294 0.1294 0.1294] EdgeColorMode: 'auto' EdgeColor_I: [0.1294 0.1294 0.1294] FontName: 'Helvetica' FontNameMode: 'auto' FontName_I: 'Helvetica' FontSize: 9 FontSizeMode: 'auto' FontSize_I: 9 FontUnits: 'points' FontUnitsMode: 'auto' FontUnits_I: 'points' FontAngle: 'normal' FontAngleMode: 'auto' FontAngle_I: 'normal' FontWeight: 'normal' FontWeightMode: 'auto' FontWeight_I: 'normal' Interpreter: 'tex' InterpreterMode: 'auto' Interpreter_I: 'tex' InitPositionCache: 1 WindowMouseReleaseListener: [0×0 event.listener] WindowMouseReleaseListenerMode: 'auto' WindowMouseReleaseListener_I: [0×0 event.listener] LineWidth: 0.5000 LineWidthMode: 'auto' LineWidth_I: 0.5000 Orientation: 'vertical' OrientationMode: 'auto' Orientation_I: 'vertical' PlotChildren: [1×1 BubbleChart] PlotChildrenMode: 'auto' PlotChildren_I: [1×1 BubbleChart] Height: 0.4448 HeightMode: 'auto' Height_I: 0.4448 Width: 0.2384 WidthMode: 'auto' Width_I: 0.2384 Position: [0.6471 0.4550 0.2384 0.4448] PositionMode: 'auto' Position_I: [0.6471 0.4550 0.2384 0.4448] SPosition: [] PositionCache: [] ParentSizeChangedListener: [0×0 event.listener] PrintAlphaSupported: 1 PrintAlphaSupportedMode: 'auto' PrintAlphaSupported_I: 1 PreventLegendResizePrintingPosition: [] SelfListenerList: [0×0 event.listener] SelfListenerListMode: 'auto' SelfListenerList_I: [0×0 event.listener] TextColor: [0.1294 0.1294 0.1294] TextColorMode: 'auto' TextColor_I: [0.1294 0.1294 0.1294] Units: 'normalized' UnitsMode: 'auto' Units_I: 'normalized' standalone: off standaloneMode: 'auto' standalone_I: off ChildrenMode: 'auto' Children_I: [0×0 GraphicsPlaceholder] Children: [0×0 GraphicsPlaceholder] SerializableChildren: [0×0 GraphicsPlaceholder] Description: '' DescriptionMode: 'auto' Description_I: '' Parent: [1×1 Figure] ParentMode: 'manual' Parent_I: [1×1 Figure] Visible: on VisibleMode: 'auto' Visible_I: on Serializable: on SerializableMode: 'auto' Serializable_I: on HandleVisibility: 'on' HandleVisibilityMode: 'auto' HandleVisibility_I: 'on' ErrorCallback: '' ErrorCallbackMode: 'auto' ErrorCallback_I: '' Internal: 0 ApplicationData: [1×1 struct] SerializableApplicationData: [1×1 struct] DefaultPropMap_Internal: [0×0 struct] Copyable: 1 NodeParent: [1×1 AxesLayoutManager] NodeChildren: [1×1 Camera2D] CustomThemePropertyMappings: [1×1 struct] HG1Erase: 'normal' HG1EraseMode: 'auto' HG1Erase_I: 'normal' EraseMode: 'normal' Behavior: [1×1 struct] BehaviorMode: 'auto' Behavior_I: [1×1 struct] HelpTopicKey: '' HelpTopicKeyMode: 'auto' HelpTopicKey_I: '' SerializableBehavior: [1×1 struct] ButtonDownFcnMode: 'auto' ButtonDownFcn_I: '' ButtonDownFcn: '' ButtonDownFcn_IS: '' SerializableUIContextMenu: [0×0 GraphicsPlaceholder] ContextMenu: [0×0 GraphicsPlaceholder] UIContextMenu: [0×0 GraphicsPlaceholder] TopLevelSerializedObject: on BusyAction: 'queue' BeingDeleted: off Interruptible: on CreateFcnMode: 'auto' CreateFcn_I: '' CreateFcn: '' CreateFcn_IS: '' DeleteFcnMode: 'auto' DeleteFcn_I: '' DeleteFcn: '' DeleteFcn_IS: '' Type: 'bubblelegend' TagMode: 'auto' Tag_I: '' Tag: '' UserData: [] SerializableUserData: [] Selected: off SelectedMode: 'auto' Selected_I: off SelectionHighlight: on SelectionHighlightMode: 'auto' SelectionHighlight_I: on HitTestMode: 'auto' HitTest_I: on HitTest: on PickablePartsMode: 'auto' PickableParts_I: 'visible' PickableParts: 'visible' CausesLayoutUpdate: on Layout: [0×0 matlab.ui.layout.LayoutOptions]
struct(hl.Axle) % but you're no longer allowed to access private object properties
No public property 'Axle' for class ''BubbleLegend''.
I don't know if it's the behavior of these newer graphics objects or just the behavior of newer MATLAB versions (or both), but it just feels like everything is becoming ultimately less flexible. There are hardly any public properties for the bubblelegend object. All of the useful ones are hidden and inacessible.
That said, I only have R2019b, which predates bubblelegend. I'm stuck trying to test this in the forum editor. I don't know if any of these restrictions are a consequence of that.
Sim
Sim 2025년 12월 10일 17:05
편집: Dyuman Joshi 2025년 12월 10일 17:07
Hi @DGM, thanks for join the discussion!
I have just tried the piece of code you used,
x = 1:10;
y = exp(-0.5*x) + .05 * randn(1,10);
sz = randi([20 500],[1,10]);
bubblechart(x,y,sz)
hl = bubblelegend('Population');
struct(hl)
Warning: Calling STRUCT on an object prevents the object from hiding its implementation details and should thus be avoided. Use DISP or DISPLAY to see the visible public details of an object. See 'help struct' for more information.
Warning: The EraseMode property is no longer supported and will error in a future release.
ans = struct with fields:
NumBubbles: 3 NumBubblesMode: 'manual' NumBubbles_I: 3 Style: 'vertical' StyleMode: 'manual' Style_I: 'vertical' BubbleSizeOrder: 'descending' BubbleSizeOrderMode: 'manual' BubbleSizeOrder_I: 'descending' LimitLabels: {3×1 cell} LimitLabelsMode: 'auto' LimitLabels_I: {3×1 cell} Padding: 8 AxleWidth: 5 AxlePadding: 5 AxleIsUsed: 1 BubbleSizes: [50 40 10] BubbleColor: [0 0 0] Location: 'northeast' LocationMode: 'auto' Location_I: 'northeast' NeutralColor: [0.4000 0.4000 0.4000] DefaultBubbleLineWidth: 0.5000 BubbleLineWidth: 0.5000 BubbleEdgeColor: [0 0 0] BubbleAlpha: 1 PrintSettingsCache: [1×1 struct] BubbleContainer: [1×1 Marker] BubbleContainerMode: 'auto' BubbleContainer_I: [1×1 Marker] Axle: [1×1 LineStrip] Bubbles: [1×1 Marker] LabelBig: [1×1 Text] LabelMedium: [1×1 Text] LabelSmall: [1×1 Text] Camera: [1×1 Camera2D] CameraMode: 'auto' Camera_I: [1×1 Camera2D] DataSpace: [1×1 UniformCartesianDataSpace] DataSpaceMode: 'auto' DataSpace_I: [1×1 UniformCartesianDataSpace] ColorSpace: [1×1 MapColorSpace] ColorSpaceMode: 'auto' ColorSpace_I: [1×1 MapColorSpace] DecorationContainer: [1×1 Group] DecorationContainerMode: 'auto' DecorationContainer_I: [1×1 Group] BoxEdge: [1×1 LineLoop] BoxEdgeMode: 'auto' BoxEdge_I: [1×1 LineLoop] BoxFace: [1×1 Quadrilateral] BoxFaceMode: 'auto' BoxFace_I: [1×1 Quadrilateral] Title: [1×1 Text] TitleMode: 'auto' Title_I: [1×1 Text] SelectionHandle: [1×1 ListOfPointsHighlight] SelectionHandleMode: 'auto' SelectionHandle_I: [1×1 ListOfPointsHighlight] TitleSeparator: [1×1 LineStrip] TitleSeparatorMode: 'auto' TitleSeparator_I: [1×1 LineStrip] Axes: [1×1 Axes] AxesMode: 'manual' Axes_I: [1×1 Axes] AxesListenerList: [1×5 event.listener] AxesListenerListMode: 'manual' AxesListenerList_I: [1×5 event.listener] Box: on BoxMode: 'auto' Box_I: on Color: [1 1 1] ColorMode: 'auto' Color_I: [1 1 1] EdgeColor: [0.1294 0.1294 0.1294] EdgeColorMode: 'auto' EdgeColor_I: [0.1294 0.1294 0.1294] FontName: 'Helvetica' FontNameMode: 'auto' FontName_I: 'Helvetica' FontSize: 9 FontSizeMode: 'auto' FontSize_I: 9 FontUnits: 'points' FontUnitsMode: 'auto' FontUnits_I: 'points' FontAngle: 'normal' FontAngleMode: 'auto' FontAngle_I: 'normal' FontWeight: 'normal' FontWeightMode: 'auto' FontWeight_I: 'normal' Interpreter: 'tex' InterpreterMode: 'auto' Interpreter_I: 'tex' InitPositionCache: 1 WindowMouseReleaseListener: [0×0 event.listener] WindowMouseReleaseListenerMode: 'auto' WindowMouseReleaseListener_I: [0×0 event.listener] LineWidth: 0.5000 LineWidthMode: 'auto' LineWidth_I: 0.5000 Orientation: 'vertical' OrientationMode: 'auto' Orientation_I: 'vertical' PlotChildren: [1×1 BubbleChart] PlotChildrenMode: 'auto' PlotChildren_I: [1×1 BubbleChart] Height: 0.4448 HeightMode: 'auto' Height_I: 0.4448 Width: 0.2384 WidthMode: 'auto' Width_I: 0.2384 Position: [0.6471 0.4550 0.2384 0.4448] PositionMode: 'auto' Position_I: [0.6471 0.4550 0.2384 0.4448] SPosition: [] PositionCache: [] ParentSizeChangedListener: [0×0 event.listener] PrintAlphaSupported: 1 PrintAlphaSupportedMode: 'auto' PrintAlphaSupported_I: 1 PreventLegendResizePrintingPosition: [] SelfListenerList: [0×0 event.listener] SelfListenerListMode: 'auto' SelfListenerList_I: [0×0 event.listener] TextColor: [0.1294 0.1294 0.1294] TextColorMode: 'auto' TextColor_I: [0.1294 0.1294 0.1294] Units: 'normalized' UnitsMode: 'auto' Units_I: 'normalized' standalone: off standaloneMode: 'auto' standalone_I: off ChildrenMode: 'auto' Children_I: [0×0 GraphicsPlaceholder] Children: [0×0 GraphicsPlaceholder] SerializableChildren: [0×0 GraphicsPlaceholder] Description: '' DescriptionMode: 'auto' Description_I: '' Parent: [1×1 Figure] ParentMode: 'manual' Parent_I: [1×1 Figure] Visible: on VisibleMode: 'auto' Visible_I: on Serializable: on SerializableMode: 'auto' Serializable_I: on HandleVisibility: 'on' HandleVisibilityMode: 'auto' HandleVisibility_I: 'on' ErrorCallback: '' ErrorCallbackMode: 'auto' ErrorCallback_I: '' Internal: 0 ApplicationData: [1×1 struct] SerializableApplicationData: [1×1 struct] DefaultPropMap_Internal: [0×0 struct] Copyable: 1 NodeParent: [1×1 AxesLayoutManager] NodeChildren: [1×1 Camera2D] CustomThemePropertyMappings: [1×1 struct] HG1Erase: 'normal' HG1EraseMode: 'auto' HG1Erase_I: 'normal' EraseMode: 'normal' Behavior: [1×1 struct] BehaviorMode: 'auto' Behavior_I: [1×1 struct] HelpTopicKey: '' HelpTopicKeyMode: 'auto' HelpTopicKey_I: '' SerializableBehavior: [1×1 struct] ButtonDownFcnMode: 'auto' ButtonDownFcn_I: '' ButtonDownFcn: '' ButtonDownFcn_IS: '' SerializableUIContextMenu: [0×0 GraphicsPlaceholder] ContextMenu: [0×0 GraphicsPlaceholder] UIContextMenu: [0×0 GraphicsPlaceholder] TopLevelSerializedObject: on BusyAction: 'queue' BeingDeleted: off Interruptible: on CreateFcnMode: 'auto' CreateFcn_I: '' CreateFcn: '' CreateFcn_IS: '' DeleteFcnMode: 'auto' DeleteFcn_I: '' DeleteFcn: '' DeleteFcn_IS: '' Type: 'bubblelegend' TagMode: 'auto' Tag_I: '' Tag: '' UserData: [] SerializableUserData: [] Selected: off SelectedMode: 'auto' Selected_I: off SelectionHighlight: on SelectionHighlightMode: 'auto' SelectionHighlight_I: on HitTestMode: 'auto' HitTest_I: on HitTest: on PickablePartsMode: 'auto' PickableParts_I: 'visible' PickableParts: 'visible' CausesLayoutUpdate: on Layout: [0×0 matlab.ui.layout.LayoutOptions]
and I got a long list of properties, like these ones:
However, if I try to modify the "DefaultBubbleLineWidth" or the "BubbleLineWidth":
hl.DefaultBubbleLineWidth = 2;
Setting the 'DefaultBubbleLineWidth' property of class ''BubbleLegend'' is not supported.
I get this error:
Setting the 'DefaultBubbleLineWidth' property of class 'BubbleLegend' is not supported.
Error in untitled (line 7)
hl.DefaultBubbleLineWidth = 2;

댓글을 달려면 로그인하십시오.

채택된 답변

Taylor
Taylor 2025년 12월 9일 16:58
The LineWidth property of bubblelegend only adjusts the border around the legend. I have submitted a feature request on your behalf to the development team to add control for the scale line as well.
  댓글 수: 5
Taylor
Taylor 2025년 12월 11일 19:14
Given that this feature request is really just exposing a private property to be public, I would think it would be a fairly quick implementation. It's cutting it close for the R2026a release though so it might not make it into that, but I know for certain that development has seen my feature request and added it to their "to triage" list. MathWorks development is a large ship to steer so even minor changes like this can take longer than one might expect.
Walter Roberson
Walter Roberson 2025년 12월 11일 19:56
As R2026a pre-release is already out, if I understand correctly, new features are now locked; from now on it is only bug fixes and removing candidate changes.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by