Remove all labels from mplfinance - matplotlib

I am trying to remove all the labels from an mplfinance plot.
Using empty spaces on y axis still leaves the scaling label and I can't seem to reove the x labeling at all.
Appreciate if anyone knew how to do this.
Trying to achieve:
Current:
code:
import mplfinance as mpf
mpf.plot(data[i-50:i], type='candle',volume=True, mav=(7,12), style='yahoo', figratio = (3.12,3.12))

The latest version of mplfinance (0.12.5a3) has a new kwarg axisoff=True will remove all labels and axis lines.

It depends on what is the code.
You can try:
plt.set_xlabel("")
or could you please provide an example, that will be really helpful.
Thanks

Related

Visualization:-x-labels and title for the graph created through matplotlib and seaborn are not displaying properly

Please find the below image. x-label and title of graph are half displayed..Do appreciate any kind of help.ty.
After applying plt.tight_layout():-
But here i got the legend details(status) overlapped with the data..is there any way to fix this?
Try to change the display size.
plt.figure(figsize=(20,10))

How to remove marker edges in seaborn.pairplot()?

Seaborn has a handy function pairplot to create a matrix of scatter plots. Unfortunately, some standard matplotlib commands don't work with it.
sns.pairplot(matrix[cols[:4]].head(100), plot_kws=dict(alpha=.5, mew=0))
The markers get some ugly white edges. I tried mew for markeredgewidth keyword to remove them as it would be used in matplotlib, but that is an unknown property for seaborn. How can I remove these edges?
A scatter does not have a mew keyword. It is edgecolor instead. Hence
sns.pairplot(data, plot_kws=dict(edgecolor="none"))
would remove the white edge around the scatterpoints.
ImportanceOfBeingErnest's answer is much more precise. Alternatively, you can also use a workaround: Set the color of choice for both the face and the edges of the markers as (example from the docs)
import seaborn as sns
sns.set(style="ticks", color_codes=True)
iris = sns.load_dataset("iris")
g = sns.pairplot(iris, plot_kws=dict(facecolor='b', edgecolor="b"))
EDIT based on comments below IOBE's answer: Just specifying the linewidth=0 also works the same way on markers as specifying edgecolor="none".
g = sns.pairplot(iris, plot_kws=dict(linewidth=0))

Hide part of an axis in a matplolib figure

How can I modulate the length of the yaxis of a matplotlib plot, as in the following figure:
In addition, how can I modulate the thickness of the yaxis?
I just found the answer. One need to use ax.spines['left'].set_bounds(4, -4).

Removing padding from Matplotlib spectrogram

I'm trying to remove the white spaces padding matplotlib's generated spectrogram. I've tried setting a limit to the axis and setting tight to the axis but these don't work.
Here's a screenshot:
Thanks
You can use plt.xlim() and plt.ylim() with the desired limits.
Your plt.axis(...) should have done, try to run it after the plot.
Similar question, and another.

how to shift x axis labesl on line plot?

I'm using pandas to work with a data set and am tring to use a simple line plot with error bars to show the end results. It's all working great except that the plot looks funny.
By default, it will put my 2 data groups at the far left and right of the plot, which obscures the error bar to the point that it's not useful (the error bars in this case are key to intpretation so I want them plainly visible).
Now, I fix that problem by setting xlim to open up some space on either end of the x axis so that the error bars are plainly visible, but then I have an offset from where the x labels are to where the actual x data is.
Here is a simplified example that shows the problem:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df6 = pd.DataFrame( [-0.07,0.08] , index = ['A','B'])
df6.plot(kind='line', linewidth=2, yerr = [ [0.1,0.1],[0.1,0.1 ] ], elinewidth=2,ecolor='green')
plt.xlim(-0.2,1.2) # Make some room at ends to see error bars
plt.show()
I tried to include a plot (image) showing the problem but I cannot post images yet, having just joined up and do not have anough points yet to post images.
What I want to know is: How do I shift these labels over one tick to the right?
Thanks in advance.
Well, it turns out I found a solution, which I will jsut post here in case anyone else has this same issue in the future.
Basically, it all seems to work better in the case of a line plot if you just specify both the labels and the ticks in the same place at the same time. At least that was helpful for me. It sort of forces you to keep the length of those two lists the same, which seems to make the assignment between ticks and labels more well behaved (simple 1:1 in this case).
So I coudl fix my problem by including something like this:
plt.xticks([0, 1], ['A','B'] )
right after the xlim statement in code from original question. Now the A and B align perfectly with the place where the data is plotted, not offset from it.
Using above solution it works, but is less good-looking since now the x grid is very coarse (this is purely and aesthetic consideration). I could fix that by using a different xtick statement like:
plt.xticks([-0.2, 0, 0.2, 0.4, 0.6, 0.8, 1.0], ['','A','','','','','B',''])
This gives me nice looking grid and the data where I need it, but of course is very contrived-looking here. In the actual program I'd find a way to make that less clunky.
Hope that is of some help to fellow seekers....