Solving MATLAB Problem: Mark an X or Cross on a Plot

  • MATLAB
  • Thread starter sstefan1
  • Start date
  • Tags
    Matlab
In summary, to mark an X or cross on a plot in MATLAB, you can use the plot or scatter function to plot the desired points, and then use either the hold on and plot functions or the text function to add the X or cross markers. These markers can be customized by changing the Marker and MarkerEdgeColor properties for the plot or scatter function, or by changing the Color and FontName properties for the text function. Multiple X or cross symbols can be added to a plot by using loops or vectorized operations, or by using the hold on and plot functions. The marked plot can be saved using the saveas or print functions. Other options for adding X or cross markers include using the line function to draw a line in the shape
  • #1
sstefan1
4
0
hi everyone!

I need to mark an X or a cross on a plot at a specific x-value. Any ideas how i can do this?

Thank you!
 
Physics news on Phys.org
  • #2
You can use the "scatter" function to put a cross on an existing 2D plot, eg.

hold on
scatter(a,b,'x')

This will put a lone cross at the coordinate (a,b) on the current plot.

I can't be more specific without knowing the kind of plot you're drawing or the nature of the point to be marked.
 

FAQ: Solving MATLAB Problem: Mark an X or Cross on a Plot

1. How do I mark an X or cross on a plot in MATLAB?

To mark an X or cross on a plot in MATLAB, you can use the plot or scatter function to plot the desired points and then use the hold on and plot functions to add the X or cross markers. Alternatively, you can use the text function to add text labels with the X or cross symbol at the desired coordinates.

2. Can I customize the appearance of the X or cross marker in MATLAB?

Yes, you can customize the appearance of the X or cross marker in MATLAB by using the Marker and MarkerEdgeColor properties of the plot or scatter functions. You can also change the color and font of the text labels using the Color and FontName properties of the text function.

3. Is it possible to mark multiple X or cross symbols on a plot in MATLAB?

Yes, it is possible to mark multiple X or cross symbols on a plot in MATLAB. You can use a loop or vectorized operations to plot multiple points and add the X or cross markers at each point. You can also use the hold on and plot functions to add multiple markers at once.

4. Can I save the plot with the marked X or cross symbols in MATLAB?

Yes, you can save the plot with the marked X or cross symbols in MATLAB by using the saveas or print functions. Make sure to save the plot after adding the X or cross markers to ensure they are included in the saved image.

5. Are there any other ways to mark an X or cross on a plot in MATLAB?

Yes, there are other ways to mark an X or cross on a plot in MATLAB. You can use the line function to draw a line in the shape of an X or cross at the desired coordinates. You can also use the rectangle function to draw a rectangle with an X or cross symbol as its border. Additionally, there are several user-created functions and toolboxes available for adding custom markers to MATLAB plots.

Similar threads

Replies
4
Views
1K
Replies
8
Views
649
Replies
4
Views
2K
Replies
5
Views
761
Replies
1
Views
1K
Replies
11
Views
2K
Replies
5
Views
2K
Replies
1
Views
5K
Replies
32
Views
3K
Back
Top