Open
Conversation
added barcode plot
catanzaromj
reviewed
Jul 3, 2024
Comment on lines
+284
to
+309
| 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() | ||
|
|
Contributor
There was a problem hiding this comment.
@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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Barcode plot function added