0

I would like to have charts without axis lines, and in general without the overall box of which the two axes are only a symmetrical half. This should work to emphasize values that overlap with the border, and also make things more aesthetic as in some seaborn and ggplot examples out there.

Can this be accomplished?

enter image description here

3
  • 2
    It's not too clear how the desired plot would look like. You could of course simply turn the axes off, ax.axis("off"). Commented Jul 10, 2018 at 15:09
  • Will that remove the entire bounding box shown above? there's only one (black) box there and I mean that one. Commented Jul 10, 2018 at 17:44
  • Best try it out and provide feedback in how far this is or is not what you're looking for. There is little that is not possible with matplotlib, but as said I don't quite understand what you're looking for. As usual, the better the problem description, the better and more useful the answer(s). Commented Jul 10, 2018 at 17:46

2 Answers 2

2

Not sure exactly what you want to achieve, but if you need to get rid of the bounding box in all you figures you can modify default matplotlib parameters (like the seaborn does):

import matplotlib.pyplot as plt

plt.rc('axes.spines', **{'bottom':True, 'left':True, 'right':False, 'top':False})

this will leave only the bottom and left part of the bounding box (you can remove everything by putting False everywhere). In this case you get something like this histogram Data area is controlled by the Spine class and you can do more with it if you'd like:

Sign up to request clarification or add additional context in comments.

Comments

1

You could color the axes spines in white, so they are not visible on white background.

For example:

ax.spines['bottom'].set_color('white')
ax.spines['top'].set_color('white') 
ax.spines['right'].set_color('white')
ax.spines['left'].set_color('white')

4 Comments

It's probably my fault, that I didn't mention this should help see when values sit on the axis itself. Very small values of course. Is there any transparent color to specify?
Are you maybe looking for a way to plot the data above the axis, without actually removing it?
You can try to plot a thicker line, so it is not entirely hidden by the axes: plt.plot(x, y, linewidth=2)
@matanster You can make the axis lines invisible with ax.spines['bottom'].set_visible(False).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.