MongoDB, the most popular NoSQL database, is an open-source document-oriented database. The term ‘NoSQL’ means ‘non-relational’. It means that MongoDB isn’t based on the table-like relational database structure but provides an altogether different mechanism for storage and retrieval of data. This format of storage is called BSON ( similar to JSON format).
Plotting sample data from MongoDB Atlas
Before Starting to plot the sample data make sure you have created an account on the MongoDB Cloud Atlas. If you have not created follow the below steps.
- Open the MongoDB Atlas Cloud from here.
- Create the account by choosing the package suitable for you (You may also choose the free version which will be enough for this article and for learning purpose).
- Click on the Cluster view positioned at the left menu bar.
- Click on the Ellipses button
(...)and select Load Sample Dataset.
- After the sample dataset is added then click on the connect button.
- Then whitelist the IP address (choose your current IP address or type the 0.0.0.0/0 IP for allowing it to access from everywhere. Click the button shown in the below image.
- Then click connect to applications button.
- Copy the cluster_uri and paste it to a “course_cluster_uri”.
- Import PyMongo and Axes3d and Matplotlib.
- Go to MongoDB Atlas Cloud by signing in.
- Paste the “course_cluster_uri” following the above steps.
- Get the client using “pymongo.MongoClient(course_url)” .
- Now set the query to filtering conditions and criteria by removing outliers that are clearly bad data.
- Convert cursor into a list.
- Now set the plot as “scatter/bar/hist” and also set Title, X-axis label, Y-axis label and legends.
- Don’t forget to type plt.show().
Below is the implementation.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Make Python API to access Mongo Atlas Database
- Python | Plotting column charts in excel sheet with data tables using XlsxWriter module
- Python | Plotting charts in excel sheet with Data Tools using XlsxWriter module | Set - 1
- Python | Plotting charts in excel sheet with data tools using XlsxWriter module | Set – 2
- Plotting Data on Google Map using Python's pygmaps package
- Plotting Geospatial Data using GeoPandas
- How to fetch data from MongoDB using Python?
- Python - Random Sample Training and Test Data from dictionary
- MongoDB Python | Insert and Update Data
- MongoDB python | Delete Data and Drop Collection
- Python | Plotting Google Map using gmplot package
- Python | Plotting Google Map using folium package
- Python | Geographical plotting using plotly
- Python | Plotting charts in excel sheet using openpyxl module | Set - 1
- Python | Plotting charts in excel sheet using openpyxl module | Set – 2
- Python | Plotting charts in excel sheet using openpyxl module | Set 3
- 3D Wireframe plotting in Python using Matplotlib
- Python | Plotting Area charts in excel sheet using XlsxWriter module
- Python | Plotting bar charts in excel sheet using XlsxWriter module
- Python | Plotting Radar charts in excel sheet using XlsxWriter module
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.