Adjust the width of the black line in bubblelegend

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 commentaires

There doesn't seem to be any property of the scale line in the bubblelegend object, which can be modified.
Sim
Sim le 9 Déc 2025
Modifié(e) : Sim le 9 Déc 2025
Thanks for your comment @Dyuman Joshi! ...I was checking the same properties and I did not find anything yet... maybe, I might ask to the @MathWorks Support Team if they might know some trick... :-)
DGM
DGM le 10 Déc 2025
Modifié(e) : DGM le 10 Déc 2025
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 le 10 Déc 2025
Modifié(e) : Dyuman Joshi le 10 Déc 2025
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;

Connectez-vous pour commenter.

 Réponse acceptée

Taylor
Taylor le 9 Déc 2025

1 vote

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 commentaires

Sim
Sim le 10 Déc 2025
Thanks so much @Taylor! Just out of curiosity — does adding a feature like this typically take several months (for example, 4—6 months or more), or is it something that could potentially be completed and released within a few weeks to a couple of months? :-)
@Sim - Given what @DGM has showed above, changing this property to be editable/making it public shouldn't take long (ideally).
However, as I am not affiliated with TMW, consider my comment as speculating only.
Hopefully a staff member can share a more practical insight.
Sim
Sim le 10 Déc 2025
Thanks a lot @Dyuman Joshi for your nice comment :-)
Taylor
Taylor le 11 Déc 2025
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.
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Distribution Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by