How do I change the default background color of view(biograph) objects created in MATLAB?

5 views (last 30 days)
I would like to change the background color of the view(biograph) object but I cant seem to be able by using standard ways of figure.
Any idea?
  1 Comment
dpb
dpb on 20 Jan 2021
Don't have the TB so no way can experiment here although you might try SAVE and see if can attach. Probably can't load w/o the TB, but "ya never know!".
My only suggestion would be if the axes created is a special axes object instead of a standard one, try Yair Altman's undocumented properties utility available from the FEX and see if can find hidden properties inside the object that let you change the features you wish.
TMW has really gone out of their way recently to make stuff opaque and/or even nearly black so one can't do anything momma won't allow.

Sign in to comment.

Answers (2)

Steven Lord
Steven Lord on 20 Jan 2021
I don't believe you can do what you ask.
If you're not required to use the biograph object consider using a graph or digraph object instead. When you plot those they are plotted inside a regular axes whose Color property you can customize.
d = digraph(sprand(10, 10, 0.2));
h = plot(d, 'EdgeColor', 'w');
ax = ancestor(h, 'axes');
ax.Color = 'r';

Tim DeFreitas
Tim DeFreitas on 20 Jan 2021
There isn't a native way to set the background color of the biograph viewer. You can select "File > Print to Figure" to get a normal figure window, and standard color setting commands should work on the axes.
Alternatively, you can create a graph or digraph, and use the plot method, which produces a figure whose background color can immediately changed.
  3 Comments
Tim DeFreitas
Tim DeFreitas on 20 Jan 2021
In this case, biograph is relatively old (2006a) and predates MATLAB graph by almost 10 years (2015b), and was originally developed for the Bioinformatics Toolbox, not as a general purpose graphing utility. I can't speak to the original authors' design, but there may have been limitations associated with using figures directly, particularly with respect to interactions between the biograph object and the viewer. Setting the background color may not have been considered an important or requested feature, so it was omitted not out of malice, but out of simplicity.
In the intervening time, users naturally requested graphing capability outside of the Bioinformatics Toolbox, and that led to the development of MATLAB graph/digraph, and the associated plots, taking into consideration cases where users might want more customization. At the same time, the graphics features of MATLAB have grown in a way that allows better integration for interactive plots, while biograph has not had many feature requests, hence the apparent feature gap.
We appreciate the feedback and do take it under consideration when developing both base MATLAB and toolboxes.
dpb
dpb on 20 Jan 2021
It seems in this case then that the Toolbox doc ought to be revised to deprecate the use of the tool inside and reflect the more general solution; perhaps for compatibility purposes simply alias it.
Just as a sidelight, having been a ML user almost continuously since Ver 3, 2006A seems pretty recent to this geezer! <VBG>

Sign in to comment.

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!