FacetGrid Seaborn taking long time to plot - seaborn

I have a major concern regarding why in the world the above code:
sns.FacetGrid(iris , row='petal_length' , col='petal_width');
This statement is taking around 10 minutes to execute and I get a single large extremely large white grid.
Why is this happening please help me removing this behavior of the code.

If you are using Jupyter notebook you need to put "%matplotlib inline" in your code after importing matplotlib.pyplot and seaborn library. It allows jupyter notebook to see the plots and diagram that you are trying to create.
I also got stuck in my NLP project then I remembered I forgot this statement in my code.
Hope it helps.

Related

How can I add basemaps to a seaborn jointplot?

Can someone guide me on how best to add a background map to two seaborn jointplots I created?
To give context, I am currently analyzing a dataset from Austin Police Dept's Crime Reports database. What I am attempting to do is visualize the density of murders and capital murders in Austin, TX. The dataset extends from the beginning of 2003 to the present.
The notebook can be located at: https://github.com/rgrantham82/Hate_Crimes_Analysis/blob/master/Austin%20Crimes%20Report%20Analysis.ipynb
So far, I visualized both data frames using the seaborn jointplot method, using latitude and longitude.
I BELIEVE this is a good method to plot the density of murders judging by the dataset but if someone has a better idea, I am open to instruction on that as well.
So, if it is even possible, how do I add a basemap to both plots?
So far, I attempted the contextily method and the geopandas method. Admittedly, this is my first attempt (outside of DataCamp class) using either method. As of to date, I am unsuccessful with both.
The contextily addbasemap() method did not produce a map (I guess it does not have one for the Austin area?). And also with the geopandas method I could not get it to work in producing a viable basemap either. I seem to be simply swamped by it.
Murders Plot
Capital Murders Plot

geopandas projection problems

I'm handling shp files now and I encountered problems with the projections.
Let me give you my code below.
import pandas as pd
import geopandas as gpd
from geopandas import GeoSeries, GeoDataFrame
import os
Aelly = gpd.read_file(r'C:\Users\Hyun Mo\Downloads\조인 (1)\after_join.shp', encoding = 'utf-8')
base_map = gpd.read_file(r'C:\Users\Hyun Mo\Downloads\11000 (3)\TL_SCCO_SIG.shp', encoding = 'ANSI')
Aelly_to_crs = Aelly.to_crs(base_map.crs)
Aelly_to_crs.plot(ax=base_map.plot())
And here is my data construction
print(base_map.head())
print(Aelly.head())
When I executed print(base_map.crs), print(Aelly_to_crs.crs), I got the results like below.
Aelly_to_crs.plot(ax=base_map.plot())
The above picture is the result of executing Aelly.plot(ax=base_map.plot())
And you can see that the two pictures don't match each other.
How can I solve this problems??
-----------edit
My desired output is below picture.
Here are my data links:
http://blog.naver.com/khm2963/220929301892
below pictures are procedure for downloading my flie
From the data that you have printed it looks like everything is working as it should! The coordinates between the shapefiles are very different, but crs is the same, so the plot totally makes sense.
GeoPandas isn't able to tell you whether the data and number make sense in a real world. You gave it two shapefiles with well defined projection (EPSG: 32652) and with hardcoded coordinates and GeoPandas is happy with that.
If you know that in reality both shapefiles represent the same area, then you are the one that has to realize that datasource is somehow corrupt. I think that one of the shapefiles accidentally got a different crs definition as a metadata (imagine it as a wrong text encoding, for instance).
The easiest way to figure that out and correct it is by using ArcGIS or QGIS software, where you can play with different projections in order to figure out, what the correct projection was. Then you can save the shapefile with new projection metadata and the rest will work out of the box.

What is a good link to examples of enaml being used with traits and matplotlib?

I have done GUI construction but not in Python. From other stack exchange questions and my own investigation. It looks like I want to use enaml and traits for the bulk of this work. Are there any links or references to help me get started.
This is a scientific application integrating matplotlib plots and text boxes and buttons (Very simple I think). I have gone through this example but don't understand it too well http://code.enthought.com/projects/traits/docs/html/tutorials/traits_ui_scientific_app.html
I have also gone through the Enthough Chaco examples and don't get very far. Has somebody built a program that I could run and look at their code? Or is their a repository of examples I am not aware of? I found the enaml examples but the example with matplotlib is basic and does not show me how to connect my algorithms to the plots. Thanks in advance!
Not a full answer, but for additional context:
1) Use https://github.com/nucleic/enaml, along with https://github.com/enthought/traits-enaml
2) Example:
https://github.com/nucleic/enaml/blob/master/examples/widgets/mpl_canvas.enaml

d3.js Merging County Polygons into Districts

I'm trying to merge counties from a "us.json" TopoJSON file into their respective agricultural districts. I've followed the "Merging States II" code found here: http://bl.ocks.org/mbostock/5416440 and it works as intended. The only problem is that it takes 10-15 seconds to load in the browser because of all the processing that is going on.
I have to believe there is a more efficient way to do this task; maybe even merging the polygons ahead of time using TopoJSON, but I'm not as familiar with that program so I'm at a loss as to how to proceed.
The html and JSON lookup files can be found at the GitHub Gist below
https://gist.github.com/nautilytics/6719443
Any comments or suggestions are greatly appreciated.
Thanks for the comments. I was able to export the three different shapefile layers from ArcGIS and then toss them into http://mapshaper.org/ to simplify them. Then I used the TopoJSON command line tool to combine them all into a single JSON file. Works amazing.
Final output: http://nautilytics.com/NASS-Corn-Acres-Planted/

Bash Stacked Column

this is the first time I have posted here.
I am trying to make a stacked column in BASH but I cannot seem to get anywhere. I just have three different columns of data I would like to stack over time. I was able to do it in excel, but not sure how to get it to work in BASH.
I did find a similar question in this site but for a different program.
plot stacked bar plot in R
But I would only need one of the charts and not two. So if anyone knows how to do a similar graph in BASH, please let me know. I'm new to programming, so sorry if it is a dumb question.
Thanks...
There is a very simple to use java package called livegraph (http://www.live-graph.org/). You feed to it an input file, with a few metadata lines on top of the input file, and it graphs it for you, in real time too. I used it in Ubuntu and it worked like a charm.

Resources