Azzera filtri
Azzera filtri

Matlab Figure Location in Your Screen

94 visualizzazioni (ultimi 30 giorni)
Guillermo Aldana
Guillermo Aldana il 14 Feb 2024
Modificato: Vaibhav il 14 Feb 2024
Is there an easy command or setting that allows me to have my plots consistently appear on the right side of my screen without manually specifying their coordinates? I recall having achieved this before, possibly through cascade or aligning them vertically, but I can't seem to remember the exact method.

Risposte (1)

Vaibhav
Vaibhav il 14 Feb 2024
Modificato: Vaibhav il 14 Feb 2024
Hi Guillermo
I understand that you would like to see the figures on the right side of the screen for every instance.
you can achieve this behavior by setting the default figure position. This involves changing the "DefaultFigurePosition" property of the root graphics object.
Here's how you can set the default figure position so that new figures appear on the right side of the screen:
% Get the screen size
screenSize = get(0, 'ScreenSize');
screenWidth = screenSize(3);
screenHeight = screenSize(4);
% Define the default figure width and height
figWidth = 560; % Default MATLAB figure width
figHeight = 420; % Default MATLAB figure height
% Define an offset from the top of the screen
topOffset = 100; % Adjust this value as needed
% Calculate the position for the new figures
position = [screenWidth-figWidth, screenHeight-figHeight-topOffset, figWidth, figHeight];
% Set the default figure position
set(0, 'DefaultFigurePosition', position);
This code snippet retrieves the screen size and then sets the default figure position to the top-right corner of the screen. You can adjust "figWidth" and "figHeight" to your preferred figure dimensions.
After running this code, any new figures you create will display at the specified position.
Hope this helps!

Categorie

Scopri di più su Data Distribution Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by