File Exchange Pick of the Week

Our best user submissions

Figures for Dark Mode

Jiro's Pick this week is dark mode plot by Natan.
Do you work in dark mode? If you do, you need to take a look at this entry by Natan, especially if you make presentations using the dark theme. As you know, standard plots in MATLAB are created with white background.
figure
plot((1:2:9).*sin((1:10)'))
If we copy and paste this into a dark theme presentation, it's probably not what you want.
normal_plot.png
Just run plot_darkmode and it does the appropriate color conversions. The background is set to a dark theme, the text and axes colors are set to white, and the line colors are adjusted accordingly.
plot_darkmode
Copy and paste into a slide, and voila!
darkmode_plot.png
It's also worth noting that the line colors are adjusted so that they are appropriately visible in dark mode. For instance, let's create a plot with two lines, a black line and a dark red line.
plot(rand(5,1),"k","LineWidth",2) % black line
hold on
plot(rand(5,1),"Color",[.5 0 0],"LineWidth",2) % dark red line
hold off
legend("Data 1", "Data 2")
You can imagine that simply setting the background to a dark theme will not work. Both lines will be hardly visible. When we run plot_darkmode, you can see that the line colors are adjusted appropriately.
plot_darkmode

Comments

Very nice entry, Natan!
Give this a try and let us know what you think here.
|
  • print

댓글

댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.