Can I Customize the Axis Appearance in Matlab2tikz?

  • MATLAB
  • Thread starter member 428835
  • Start date
  • Tags
    Axis
In summary, the conversation is about using matlab2tikz to control the appearance of axis in a tikZ file. The first figure attached is an example of the desired axis appearance, while the second figure is the automatic generation by matlab2tikz. The suggestion is to plot the function in MATLAB and then manually edit the tikZ file for a better result.
  • #1
member 428835
Hi PF!

I am running matlab2tikz and it is working great. However, is there a way to control what the axis look like? Right now my axis have an entire square. Anyone know a way to edit this in the tikZ file?

I've attached two figures, the non-square one is what I would like my axis to look like and the square one is what matlab2tikz automatically generates.

Thanks so much!

Josh
 

Attachments

  • Screen Shot 2016-05-20 at 11.38.43 AM.png
    Screen Shot 2016-05-20 at 11.38.43 AM.png
    50.7 KB · Views: 567
  • Screen Shot 2016-05-20 at 11.38.52 AM.png
    Screen Shot 2016-05-20 at 11.38.52 AM.png
    26.9 KB · Views: 552
Physics news on Phys.org
  • #2
They both look square to me.

EDIT never mind I see that the first is non-square and prettier

Can you control it by limiting the axis range?
 
  • #3
jedishrfu said:
They both look square to me.

EDIT never mind I see that the first is non-square and prettier

Can you control it by limiting the axis range?

I think the best thing to do is plot the function in MATLAB and then run matlab2tikz and draw on top of the image in tikZ.
 

Related to Can I Customize the Axis Appearance in Matlab2tikz?

1. How do I change the font size and style of the axis labels in MatLab2tikz?

To customize the font size and style of the axis labels in MatLab2tikz, you can use the "xlabelstyle" and "ylabelstyle" options in the "matlab2tikz" function. For example, to change the font size to 12 and the font style to bold, you can use the following options: xlabelstyle={font=\fontsize{12}{14}\selectfont\bfseries}, ylabelstyle={font=\fontsize{12}{14}\selectfont\bfseries}.

2. How can I add a title to my plot in MatLab2tikz?

You can add a title to your plot in MatLab2tikz by using the "title" option in the "matlab2tikz" function. For example, if you want the title to be "Plot Title", you can use the following option: title={Plot Title}.

3. Can I change the color of the axis lines in MatLab2tikz?

Yes, you can change the color of the axis lines in MatLab2tikz by using the "axis line style" option in the "matlab2tikz" function. For example, to change the color to red, you can use the following option: axis line style={red}.

4. How do I add a legend to my MatLab2tikz plot?

To add a legend to your MatLab2tikz plot, you can use the "legend entries" and "legend style" options in the "matlab2tikz" function. First, you need to specify the labels for each plot by using the "legend entries" option, and then you can customize the legend style by using the "legend style" option. For example, if you have two plots with labels "Plot 1" and "Plot 2", you can use the following options: legend entries={Plot 1,Plot 2}, legend style={at={(0.5,-0.2)},anchor=north}. This will place the legend at the bottom center of the plot.

5. Is it possible to change the tick labels on the x and y axis in MatLab2tikz?

Yes, you can change the tick labels on the x and y axis in MatLab2tikz by using the "xticklabel" and "yticklabel" options in the "matlab2tikz" function. For example, if you want the tick labels on the x axis to be "1", "2", and "3", you can use the following option: xticklabel={1,2,3}. Similarly, you can customize the tick labels on the y axis by using the "yticklabel" option.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
1K
  • DIY Projects
Replies
12
Views
2K
Back
Top