-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Barcode Plot #68
base: master
Are you sure you want to change the base?
Conversation
added barcode plot
ax.set_yticks(yticks) | ||
ax.set_yticklabels(labels) | ||
|
||
#Remove grid from yaxis | ||
ax.grid(which='major',axis='x') | ||
ax.set_facecolor('white') | ||
|
||
if x_axis_label is not None: | ||
ax.set_xlabel(x_axis_label) | ||
|
||
if x_range is not None: | ||
ax.set_xlim(x_range) | ||
|
||
#Ensure bars aren't thick on plot | ||
if len(ax.patches) < 15: | ||
ax.set_ylim(ax.get_ylim()[0], 15) | ||
|
||
if title is not None: | ||
ax.set_title(title) | ||
|
||
if legend is True: | ||
ax.legend(loc="lower right") | ||
|
||
if show is True: | ||
plt.show() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bf108 What do you think about removing all this? My philosophy with plotting functions has changed recently, and now I think they should be pretty minimal. In particular, I think this method should return the (fig,ax)
pair it creates and then the user is free to modify it (e.g., with ax.set_title
, ax.legend
etc.) after it is constructed. They can also call plt.show() when they'd like, or save it directly from the ax
object.
This would allow us to remove quite a bit from the function signature as well. We could then add documentation for how a user could modify the plot after its been created with this function, e.g. showing how to add and move a legend or a title.
Barcode plot function added