0

How do I generate graphs with matplotlib that show the distribution values of some variables of a JSON file? for example in this picture, i need to make a hist graph of "borough"(im using pymongo at a notebook) enter image description here

im expecting to see a histogram of "borough"

1
  • post the code and not the pictures of code. Users need to be able to replicate the problem quickly, which text allows for (and pictures do not). stackoverflow.com/help/how-to-ask Commented Jan 11, 2023 at 16:04

1 Answer 1

0

Can you try something like this ?

import matplotlib.pyplot as plt
x = [i for i in range(len(query_borough)]
h = [doc['result'] for doc in query_borough]
t = [doc['_id'] for doc in query_borough]
plt.bar(x, height=h)
plt.xticks(x,t);

Based on How to plot a histogram using Matplotlib in Python with a list of data?

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

Comments

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.