Skip to content

Make plot_histogram & iplot_histogram similar #864

@ajavadia

Description

@ajavadia

What is the expected enhancement?

1- Make the function signature the same for both functions
2- Make the iplot_histogram default when using jupyter and connected to internet.

How to do this?

In order to easily switch between the plot_histogram and iplot_histogram functions, both need some changes.
1- The plot_histogram function must be able to plot multiple histograms in one figure, just like iplot_histogram does.

2- We have to stay backward-compatible. Therefore, the iplot_histogram(counts) should work.

So I'm thinking we use this function signature?

[i]plot_histogram(counts = {'000': 4, '010': 10}) # plot a simple counts histogram
[i]plot_histogram(counts = [{'000': 4, '010': 10}, 
                            {'000':8, '001': 4, '010': 9}]) # plot 2 histograms in one fig
[i]plot_histogram(counts = [{'000': 4, '010': 10}, {'000':8, '001': 4, '010': 9}],
                             legend = ['simulator', 'device']) # plot 2 histograms w legend
iplot_histogram(counts, legend, options) # the fancy options of the interactive plotter

More details

iplot_histogram
In the above, I'm proposing splitting the executions_results arg into a counts arg and a legend arg. I don't think we need the device thing at all.

plot_histogram
plot_histogram has a number_to_keep arg which i think should be absorbed in options. It will be a breaking change, but it does not affect as many users as the regular counts arg.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions