fabiochiu/medium-articles huggingface dataset:
Another Dimension To Visualize Data In Python
By: Amit Naik
Tags: Data Visualization, Data Science, Plotly, Interactive, Analytics

Getting Started

Plotly charts can be made in Jupyter notebooks and then the visualization itself can be exported to plotly. To install plotly just type in the following command pip install plotly . To run it in Jupyter, use the code snippet below.

import plotly.plotly as py

import plotly.graph_objs as go

import plotly.offline as off

The ‘offline’ library is necessary if you want the visualization to appear on the notebook itself instead of redirecting to your plotly account.

Time Series

We all know that time series graphs are really useful in data analytics because we want to know the trend of the data in question over time. A neat way to show time series in a single visualization is to use a slider. The slider acts as a timeline and can show us the trend of data over any period of time (based on the data set). We can do this by using the ‘slider’ parameter. The code snippet is shown below.

#Defining the layout of the plot

slider = [dict(

active = 0,

currentvalue = {"prefix": "Year: "},

pad = {"t": 50},

steps = steps

)] layout = dict(

title = 'Casualties vs. Wounded individuals',

xaxis = dict(title = 'Number of wounded'),

yaxis = dict(title = 'Number of casualties'),

sliders = slider,

hovermode = 'closest',

) #Plotting the figure

py.offline.iplot(

dict(

data = data,

layout = layout

)

)

As seen above, we can set the timeline of the slider as well as the number of steps (years) between each tick. This makes the visualization very interactive. The slider shows us the pattern over the years and also we can identify each circle by hovering over them. This visualization shows 4 different dimensions in a single plot. This would have been a very tedious task to do in matplotlib.
Data visualisation: 3 secret tips on Python to make interactive graphs and impress your boss.
By: Sajid Lhessani
Tags: Python 101, Data Science, Plotly, Python, Data Visualisation

Data visualisation: 3 secret tips on Python to make interactive graphs and impress your boss.

In this article, I will give you my top3 data visualisation tips using Python and PlotLy (as a data scientist), which will make your audience ecstatic. Tested and approved. Sajid Lhessani Nov 14, 2020·4 min read

Photo by Alexander Kagan on Unsplash

Along with this article, I will try to enhance Python possibilities to make your graph interactive, good looking and let your boss impressed. The goal behind these tips is to give a better impression and enhance the user/client experience. It works!

As a summary, the 3 goals will be:

1. Interactivity (Tips#1, #2 and #3)

2. Good looking graphs (Tips #3)

3. Impress your boss (Tips#1, #2 and #3)

Gif from Giphy.com

These three tips are coming from my experience in front of clients after working for 3 years as a data scientist. If you have other ideas feel free to share in the comment.

In this article, we will cover Tips #1.

Let’s get started.

0. Prerequisite

Before to start, make sure you installed a Python3 version and the following packages:

Pandas

Plotly

Pandas DataReader

The code below will not run with Python 2

Once you have ensured that the packages above are installed, we are going to use Pandas DataReader to import market data. In this case, we are going to import data for Tesla.

If any of these packages are not already installed, you can use the pip command, as shown below.

pip install pandas-datareader

pip install DateTime

If you want to read more on algorithmic trading and how to get market data, I highly recommend this brilliant article:

If you are too lazy to read, you can find the lines of code below:

Lines of code used to import market data

Once you have uploaded the data from Tesla, the output and the dataset which will be used is the following one:

Expected output after running the code above and Yahoo Finance API.

Now that the prerequisites are solved, we can start by the first tips.
Creating Automated Python Dashboards using Plotly, Datapane, and GitHub Actions
By: Hakkı Kaan Simsek
Tags: Data Visualization, Data Analytics, Github Actions, Plotly, Data Analysis

Today, most online data science courses teach you about machine learning and deep learning; you learn how to optimize hyperparameters rather than the fundamentals such as SQL, Data Analysis, Reporting, Cloud Services, etc. But in the real world, analyzing data, learning how to ‘automate the boring stuff,’ creating ETL pipelines and dashboards, and guiding stakeholders or clients to the correct path often delivers much more value. More data teams fail because data science never influences business decisions, than because their model wasn’t optimized.

In the real world, the problems data scientists face aren’t only how to tweak ML models and compare metrics, like they would in Kaggle competitions. The problem they face is to be stuck on local Jupyter Notebooks and don’t have a way to connect with the person consuming their analysis. If we build data products (such as ML models, automated platforms, or reports) that don’t help stakeholders’ or clients’ decision processes, we miss our original “reason for being.”

High-level executives are interested in numbers and insights; not which activation function you used in your neural networks.

The main driving factor of good data products is to collaborate with business units and get feedback regularly. The more you actively participate in the decision-making process, the more you learn about how to test hypotheses and solve “real” problems, not textbook ones. At the end of the day, your findings and stories will turn into actions that drive outcomes.

Unfortunately, you can’t send your notebook to a stakeholder and expect them to understand it and run it themselves. This means that, in a lot of companies, you get an email from a business unit with a request, re-run a Jupyter Notebook, and then manually build a PowerPoint or Excel spreadsheet. This manual process means that data scientists are the bottleneck for insights and spend their days manually building reports instead of solving hard problems.

The initial but critical step to interact with problems is to create KPIs and well-crafted, automated reports and dashboards which can deliver value and remove the need for you to be involved in every question or data refresh. After brainstorming with stakeholders (product, growth, marketing managers, etc) and collaborating with engineers, you could start this process. Luckily, the Python ecosystem provides some handy tools to build and workflows.

In this article, we will be using Python to pull the stock market prices live using pandas datareader and create an interactive report using Plotly and Datapane. We will then use GitHub actions to trigger our code to run every day to update our report.
Visualizing My LinkedIn Network
By: Tavish Gobindram
Tags: Data Visualization, Data, Jupyter Notebook, Plotly, LinkedIn

Visualizing My LinkedIn Network

From Kim’s Convenience, Courtesy of Giphy

That’s pretty much how I feel at networking events in real-life. However, using LinkedIn to build up my network has been a completely different experience — I even landed one of my internships by cold-messaging someone on the platform. So I really value this platform, a lot.

Where LinkedIn falls short

But LinkedIn has failed me in one major aspect, it’s really hard to understand your network. What I mean by this is that LinkedIn doesn’t provide any handy statistics or visual tools to let you understand your LinkedIn-sphere which makes it hard to leverage it to the max.

This is pretty much as good as it gets when it comes to exploring your own LinkedIn network.

My Network -> Connections -> Search With Filters

All the filters to search with

You can play around with some filters, but that’s it. You can’t really see your whole network as a glance or any statistical summaries, so it’s hard to derive an understanding of your data.

I feel that visualizing my network, would help me finally understand my LinkedIn footprint — who’s in them, where do they work, is it diverse etc. And until this becomes a feature on their platform, I hope you’d be inspired to be proactive and visualize your own network to finally understand what kind of people make up those 500+ connections in your network.

Getting my LinkedIn Data

If I want to visualize my network, the first step is to get my network data. You might think that there’s an API for this, and you’d be right. But LinkedIn’s API is not so straightforward to use — multiple permissions are needed to access connection data and for good reason. But all I need to visualize my network is my data. And LinkedIn is nice enough to make the process of downloading your own data fairly simple — no APIs necessary, just download a good old csv file.

You can find this by going to the Settings & Privacy Section of your profile

Time for the fun part — Visualizations!

So now that the data is available, I need to start analyzing the hell out of it — my go-to tool for this is the trusty Jupyter Notebook.

Here’s the first few rows from the Connections.csv file I downloaded.

import pandas as pd

df = pd.read_csv('Connections.csv')

df.head()

It lists the emails, current positions and companies of everyone in my network and when they became a part of my network. But printing rows of a csv is clearly not the best way to visualize or understand my network.

To visualize my entire network in one glance, I’ll be using Plot.ly’s Tree Map.
How to quickly find the best bins for your histogram
By: Tobias Krabel
Tags: Data Visualization, Jupyter Notebook, Data Science, Plotly, Python

Histogram with interactive binning

In this graphic you can see the end result. If we change the bin width through a slider, the plotly graph adjusts automatically.

In order to implement this behavior, we combine plotly.graph_objs (creates the plotly graph) with an ipywidgets.Floatslider .

This is the code for creating the rebinnable histogram.

Let’s go through it line by line.

Explaining the code line by line

0. Function signature

Note that our function takes two arguments: series a pandas.Series, and initial_bin_width , specifying the bin width we want to have a as a default in our plot. In our case, its a 10-minutes air time window.

1. Creating the figure

We generate a new FigureWidget instance. The FigureWidget object is the new “magic object” of plotly. You can display it within Jupyter Notebook or JupyterLab like any normal plotly figure. However, this approach has some advantages:

FigureWidgets can be combined with ipywidgets in order to create more powerful constructs (in fact, that’s what FigureWidgets are designed for)

you can manipulate the FigureWidget in various ways from Python

in various ways from Python you can also listen for some events and

when an event is triggered, you can execute more Python code

The FigureWidget receives the attribute data , which specifies a list of all the traces (read: visualizations) that we want to show. In our case, we only want to show a single histogram. The x values for the histogram are coming from the series . We set the bin width by passing a dictionary to xbins . When we set size=None in the dictionary, plotly will choose a bin width for us.

2. Creating the slider

We generate a FloatSlider using the ipywidgets library. Via this slider, we will later be able to manipulate our histogram.

3. Saving a reference to the histogram

We get the reference to the histogram because we want to manipulate it in the last step. In particular, we will change the xbins attribute of our object, which we can access via histogram_object.xbins .

4. Write and use the callback

The FloatSlider we have implemented comes with some magic. Every time its value changes (i.e. we move the slider), it triggers an event. We can use that event to update the bin width in our histogram. Technically, you do that by calling the observe method on the bin slider, pass it the function you want to call ( set_bin_size in our case) and tell it when to call the function ( name="value" meaning that we call the function whenever the value of the slider changes). Now, whenever the slider’s value changes, it will call set_bin_size . set_bin_size has access to the slider’s value through the magic argument change — a dictionary containing data about the event triggered by bin_slider . For example, change["new"] contains the new value of the slider, but you can also access its previous value with change["old"] . Note that you don’t have to use the argument name change . You can give it any name you want.
Productivity: Jupyter notebooks inside an IDE
By: Cfm Tech
Tags: Jupyter Notebook, Pycharm, Plotly, Visual Studio Code, Version Control

PyCharm and VS Code are two major Integrated Development Environments (IDE) for Python code. Notebooks are widely used for doing calculations in Python. We are happy to introduce an article by CFM’s Marc Wouts, that discusses how these popular tools can be brought together to increase your productivity.

In recent years, we have witnessed an effort by PyCharm to make notebooks editable in the IDE. But PyCharm is not the only editor with a notebook strategy. Many competitors are embracing notebooks. A serious challenger seems to emerge; Visual Studio Code, with convincing arguments: open source code, free, with a good momentum and a rapidly growing user base.

Editing Jupyter notebooks in an IDE can in principle provide multiple benefits:

Editing notebooks can become simpler. Can we copy, paste or merge multiple notebooks as easily as we can with scripts?

Can we navigate in the code and benefit from interactive suggestions (documentation, completion, checks…)?

Can we debug, set breakpoints and watch notebook variables?

Can we use a single editor to edit and maintain all our documents?

Is editing your notebooks in an editor viable today? Marc Wouts, author of Jupytext and researcher at CFM has written an article sharing how he has been able to work with notebooks inside IDEs. He provides a benchmark of PyCharm vs. VS Code that should be of interest to anybody who wants to be more productive with Jupyter notebooks.

CFM is an asset manager using science and technology to develop quantitative and systematic investment strategies, and is thus a heavy user of Python (for data manipulation and analysis, production, etc.) and of Jupyter notebooks (for interactive research). Therefore Marc draws his experience from real life applications, which makes his article all the more relevant.

You can find the main article on the Towards Data Science blog or on GitHub.
How to Build a Web App in 50 lines of code using Plotly and Dash
By: François St-Amant
Tags: Data Visualization, Dash, Plotly, Web Based Applications, Python

2. DASH

The Dash platform allows us newbies to produce quality enterprise-ready analytic apps without the need for developers, JavaScript or anything more than basic Python skills for that matter.

With Dash Open Source (the free version), Dash apps run on your local workstation. You cannot share the app itself but you can always share the code.

Every complete Dash app has three parts:

The layout, which describes what the application looks like. The Dash core components (called dcc), which is basically the content of the application (graphs, dropdown menus, checkboxes, etc.). The callbacks, which make the app interactive, by having the components interact with one another.

Here is all the code you need to create a Dash app that contains the table we created earlier:

#Import libraries

import dash

import dash_core_components as dcc

import dash_html_components as html #Create the app

app = dash.Dash()

app.layout = html.Div([

dcc.Graph(figure=fig_totalsales)

])



app.run_server(debug=True, use_reloader=False)

That’s all! As easy as it gets. We see that this app contains a layout as well as one core component, the figure.

The html.div tag is what defines a new section in the app, where we can add any Dash Core Component we want (dcc.Graph here). Here is what the “app” looks like right now:

Now of course, if someones wants to create an application, it’s not to show a single plot. You could have done that with any python library. What makes Dash great is that you can have different components interacting with one another. That’s where the third part of Dash, the callbacks, comes into play.

A callback asks for an input, makes it go through a function and gives an output. Let’s see how we could improve our current app (there are a million things we could do, here’s a few).

Final App idea

1. Add a title. 2. Add the ability to filter through our figure to only show the data points for a specific range of dates. 3. Add an interactive text box, showing the sum of the sales for the selected period.

Dash has a core component called DatePickerRange. All we need is a callback to link the figure and the text with this new core component.

Here is the full code that does just that.

Here is a block by block description of the code:

The first html.div is there to create a section with the title of the app.

The second html.div adds the DateRangePicker component as well as the 2 outputs that will be linked to it via the callback (a text element and a figure).

The last part is the callback. It asks for 2 inputs, i.e. the two dates and it gives 2 outputs, i.e. the figure and the text. Inside the update_output function, the data is selected based on the dates provided. Then, the sales total is calculated and the figure is created.

Here is a short video showing what the app looks like now:

There you have it, a decent looking web-based application in less than 50 lines of code! Check this out for more information on Dash: https://dash.plotly.com/.

Thanks a lot for reading!
Sankey Diagram Basics with Python’s Plotly
By: Thiago Carvalho
Tags: Data Visualization, Data Science, Plotly, Sankey Diagram, Python

The Logic

Building a Sankey can be quite a struggle especially if you have too many nodes and connections, I’ll use lists for the examples to make it simpler, but you can adapt this logic with a JSON file or a Pandas Dataframe.

We will use go.Sankey to build the chart, which requires a link .

That link is a dictionary containing data about the connections we want to draw.

source = [0, 0, 1, 1, 0]

target = [2, 3, 4, 5, 4]

value = [8, 2, 2, 8, 4]

The source and target are lists of indexes for the nodes Plotly will connect, and the value is a list of numbers that will define the width of these connections.

link = dict(source = source, target = target, value = value)

data = go.Sankey(link = link)

print(data)

We saved the Sankey object to a variable called data, and now we can pass that data to a Figure;

fig = go.Figure(data)

And display the chart.

fig.show()

That’s the idea. Let’s try identifying those nodes so we can have a more unobstructed view of what is connecting what.

We’ll need a dictionary with the node’s data, which should contain a list with the labels. We can also add more parameters such as pad to customize the distance between the nodes, or thickness to define the size of their handles.

# data

label = ["ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE"]

source = [0, 0, 1, 1, 0]

target = [2, 3, 4, 5, 4]

value = [8, 2, 2, 8, 4] # data to dict, dict to sankey

link = dict(source = source, target = target, value = value)

node = dict(label = label, pad=50, thickness=5)

data = go.Sankey(link = link, node=node) # plot

fig = go.Figure(data)

fig.show()

That’s easier to understand. We can read the lists, and visualize how they connect.
Visualizing spatial data with geojson heatmaps
By: Jan Majewski
Tags: Spatial Analysis, Data Vizualization, Geojson, Real Estate, Plotly

Visualizing spatial data with geojson heatmaps

Heatmaps are a great way of visualization, but plotting them on a map can be a challenge. Learn how to create immersive maps using geojsoncountour to create custom geojson data. Jan Majewski Jun 28, 2020·5 min read

Warsaw Real Estate prices [PLN/m2]

Have you ever worked with spatial data and faced the challenge of having to choose between overcrowded scatter plots or choropleth maps limited to administrative boundaries such as districts?

Working as a data scientist in the real estate industry, I often deal with spatial data, however, I was struggling to find the optimal way of visualizing spatial data in a way that would make it easy to grasp key spatial features from large data sets.

The basic features provided by Plotly or Folium felt limiting so I decided to do a bit of research on how to create custom heatmaps on top of a map, which I want to share with you in this article. I will be working on a data set of >10k Real Estate offers in Warsaw from May 2020, which you can download from my GitHub in the link below.

Whole code and data sources are available on GitHub: https://github.com/Jan-Majewski/Project_Portfolio/blob/master/03_Real_Estate_pricing_in_Warsaw/03_02_Data_Vizualization.ipynb

For interactive visualizations, I recommend using nbviewer link: https://nbviewer.jupyter.org/github/Jan-Majewski/Project_Portfolio/blob/c770f21dc410b1495dbdf5b9f4f443ecd4d986ba/03_Real_Estate_pricing_in_Warsaw/03_02_Data_Vizualization.ipynb
Meet Plotly Mapbox. Best Choice for Geographic Data Visualization
By: Kefei Mo
Tags: Data Visualization, Towards Data Science, Plotly, Geographic, Python

Issues you might encounter

So far, you should have mastered the basic stuff of interactive geo data scatter plot using Plotly. Now let’s discuss some common issues and potential roundabouts.

One issue is about overlapping.

Sometimes, overlapping results from the dataset itself. You might have noticed the coordinates data (i.e., latitude, longitude) is at 0.01. When plotting on the tilemap, this easily causes overlapping. Note that there is no jitter option. We might have to add jitter to the data manually. (Somehow, I think jitter is not trivial for interactive scatter visualization since the jitter parameter has to change accordingly as the scale change (e.g., zoom in and zoom out). We might need an adaptive jitter method if were to apply jitter to an interactive plot.)

In my opinion, to overcome overlapping, a ready-to-go solution is to adjust the scatter size (e.g., decrease the size of scatter to mitigate overlapping). But for px.scatter_mapbox, in 4.8.1 Plotly version, we cannot specify size using an int (no matter what says in the documentary). But there are ways to hack that, for instance, create a column in the data frame designated for scatter size.

Try the following code:

‘Hack ’size parameter.

# px.set_mapbox_access_token(mapbox_access_token)

fig = px.scatter_mapbox(df_plot_tmp, lat="latitude", lon="longitude",

color="gender",

size='size_for_plot', size_max=2,

category_orders={'gender':list(df_plot_tmp.gender.unique())},

color_discrete_sequence=['#2b83ba', '#fdae61'],

# hover_data=1,

# hover_name='hour',

# text='hour',



zoom=2.8,

center=dict(lon=105, lat=38),

width=900, height=600,

title='modified scatter size')

fig.show()

Manually add jitter
How to Use Microsoft’s Graph API to Query, Create and Analyze Data from OneDrive, Outlook and more
By: Dominik Polzer
Tags: Plotly, Microsoft Graph Api, Django, Python, Oauth

Graph Quick Start — a fast way to start with the Graph API

A few years ago, Microsoft switched from Live SDK to Microsoft Graph. Microsoft Graph is now the API to access all the data and insights in Microsoft 365. [1][2]

There are several ways you can start with Microsoft Graph API. The fastest way is to use the Graph Quick Start, which creates a new App ID and App Secret for the authentication process and already provides you with a first sample project.

(1) In the first step you need to define the language you want to use to build your App. Since I prefer Python, the example app will be a simple Django app.

Select the language — Image by the author

If you are not familiar with Django, you can take a look at one of my previous articles, which explains the principle of Django as simply as possible and includes the most important points. In case you prefer to build your own app from scratch, you can also find a tutorial how to do that in the Microsoft docs.

(2) After selecting the language, the Quick Start gives you the option to directly create a new App ID with App Secret, which you will need later on for the authorization process.

To get an overview of your registered apps, you can do so in your Azure Portal under Azure Active Directory.
Getting started with Visualizations in Python
By: Pranjal Gupta
Tags: Data Visualization, Python3, Data Science, Plotly

Visualizing anything gives us a better understanding, a holistic picture of things, be it the monthly turn over of your company, the increasing temperature, or even tensed situations where you could have outrun everyone else, believe me, the later one works.

The aim of art is to represent, not the outward appearance of things, but their inward significance.

— Aristotle

Visualization is an art, it does not just represent the data better, but it actually pictures the trends, the patterns and other signs that are hidden deep within the data, and can’t be figured out just staring at the data.

It’s one of the crucial arts’ that need to be mastered by anyone who wants to pursue Data Science, without which you’ll be incomplete, your assignments, your tasks will be incomplete especially when you turn up to someone to explain, Why did this Happen?

Let’s have a look at some of the most common plots;

Hold your Horses First.

Shouldn't we first look into what will it take here to plot?

There are so many open source libraries available at your disposal, and what it actually takes to do is the will to do.

Don’t kid me now!

Obviously, you need a laptop and Jupyter Notebook, maybe some of Python basics too.

Let’s get started now.
Three Ways to Plot Choropleth Map Using Python
By: Burger Wu
Tags: Choropleth Map, Data Visualization, Folium, Plotly, Python

Photo by Angela Lo on Unsplash

Choropleth map is an exceptional choice for presenting geospatial data. In this article, we will introduce you to three methods for plotting Choropleth map. Let’s begin.

Github Repo: here

Data Preparation

In order to demonstrate our choropleth map, we have acquired population data for every city and county of Taiwan as our dataset of interest. You can find the dataset in this website. Below is the final dataframe after cleaning and data manipulating. We will later use this dataframe to do out Choropleth plotting.

Get Json

Geojson is a important part of Choropleth map because it records the actual outline of the area of interest. You can find the geojson of Taiwan from here. As for other country or region, you may find useful information by searching the internet.

1. Folium

Folium is a Python library specializing in visualizing geographical data, of course including Choropleth map. This is our first method of plotting Choropleth map. For more information and documentation, please check here.

Below is the code for plotting Choropleth map using Folium.

Below is the result of Choropleth map of Taiwanese administrative division population using Folium.

2. Plotly

Plotly is a Canadian software company, but in this porject, the Plotly we are talking about is an advanced plotting libraries in Python known for interactive plots made by Plotly. You can check out here for more information.

Below is the code for plotting Choropleth map using Plotly.

Below is the result of Choropleth map of Taiwanese administrative division population using Plotly.

3. GeoPandas

Below is the code for plotting Choropleth map using Geopandas.

Below is the result of Choropleth map of Taiwanese administrative division population using Geopandas.

Conclusions

In this project, we create Choropleth map using three different Python libraries, folium, plotly and geopandas.

Folium:

Folium can create professional, interactive maps but it is relatively hard and complicated to build one map. It requires function or tooltip object to further enhance the map.

Plotly:

Plotly can create professional, interactive maps along with some more default functions as well as pre-built styles. It may be a bit more convenient than Folium to create maps with diverse styles.

Geopandas:

Geopandas can create non-interactive maps but it’s relatively fast to build one map. Also, geopandas allows you to work with pandas dataframe with which most Python users are familiar.

All of the three can successfully convey the information we would like to share through Choropleth map, it’s up to you to decide which is the best for you. Also remind yourself, interactive maps should be more memory consuming than normal maps.

There are still a lot of parameters you could try to beautify your map. Other than searching for technical documents, also try to search online to see if anyone else has already created one you would like. You can find the notebook, dataset and other information of this projec in Github Repo.

Reference
ggplotly() — the most bang for buck function in the extended tidyverse
By: Owen Flanagan
Tags: Data Visualization, Tidyverse, Data Science, Plotly, R Language

ggplotly() — the most bang for buck function in the extended tidyverse

I’m a big fan of the tidyverse and ggplot. The tidyverse is an excellent framework for exploratory data analysis and ggplot is awesome. The ability these tools provide to import data, reshape it and visualise it is extremely powerful.

Alongside the core tidyverse there are many supporting packages. Of all the functions, in all these packages, there is one function that delivers a whole lot of value for a single function call.

ggplotly()

This is a single function call you can wrap around your ggplot() functions to make interactive visualisation.

The key value I find it brings are adds it brings are:

You can zoom and pan around the plot

You can hover over points to see their value

It is simple to get running:

You only need to wrap your existing code in ggplotly()

Installation is as simple as install.packages(“plotly”)

Example

As an example, I have created a standard scatter plot using ggplot. This is the usual starting point for a lot of my data exploration.

iris %>%

ggplot(aes(x=Sepal.Length,y=Sepal.Width,color=Species)) +

geom_point()

From here I will often want to zoom in and investigate the data further. My standard pattern for doing this is to pipe my data frame through a filter on the way to ggplot:

iris %>%

filter(Sepal.Length < 7, Sepal.Length > 5) %>%

ggplot(aes(x=Sepal.Length,y=Sepal.Width,color=Species)) +

geom_point()

I can then narrow down these filters to isolate the points I am interested in, and if I want to look at those points in detail I can replace the call to ggplot() with a call to View() as shown below.

iris %>%

filter(Sepal.Length < 7, Sepal.Length > 5,

Sepal.Width < 4, Sepal.Width > 3) %>%

View()

These techniques work but can be a little fiddly. Often, what I would really like is to be able to create a visualisation using ggplot(), while also being able to interact with it to zoom in. This is where ggplotly() comes in.

ggplotly(iris %>%

ggplot(aes(x=Sepal.Length,y=Sepal.Width,color=Species)) +

geom_point())

The key value here is that I can create my plot using the tidyverse as usual, and then simply wrap it in a single function call to make it interactive. This can be extremely useful for exploratory data analysis.

I have also found ggplotly() to be a valuable addition to Shiny dashboards. I think the ability to zoom and information on hover provided by ggplotly() is arguably more valuable in Shiny. I think this because a dashboard is often used by someone other than the person who built the plot and so is less familiar with the data set. I also think that the interactive ggplotly() plots are far more satisfying to use than a static plot and a set of filter sliders on a Shiny App.

I have uploaded a live version of this plot to RPubs if you would like to play with it yourself, it is accessible through the link below. Of course, it is so easy to get going that you might as well do it yourself.
Who is Bernie Sanders? Visualization answers!
By: Mohammad Mahdi Samiei
Tags: Plotly, Visualization, Sanders, Text Mining, Twitter Data

Do you know Bernie Sanders? Briefly and usefully he is is an American politician who is nominated for 2020 United States presidential election. First he should defeat his rivals in Democratic Party and if he can do that, then he should compete with Donald Trump! Before anything I should say the fact that in this article We want to know him better by visualize his tweets! For this post I have used some of the contents and methods of this post, I thank Susan Li so much for that! Another point is that I have benefited from Plotly and Skelarn too.

Firstly, we should extract his tweets, I have prepared it for you at here. it consists of approximately 13000 tweets that are all of Bernie Sanders’ tweets. Let’s load and take a look at it.

df = pd.read_csv('BernieSanders-13k-tweets.csv')

df.head(5)

Now, i don’t need Unnamed column and also I should remove tweets that their text is empty:

df.drop('Unnamed: 0', axis=1, inplace=True)

df = df[~df['Text'].isnull()]

Now let’s create and add new features to our data:

I added a polarity column which show the sentiment polarity scores of the each tweet. this score is calculated by textblob library.

Now let’s visualize the distribution of tweets polarity score:
Data Visualization Using Plotly with Code Examples
By: Haitian Wei
Tags: Data Visualization, Data Science, Plotly, Interactive, Charts

Data visualization is very important for data scientists. Plotly’s Python graphing library makes interactive, publication-quality graphs.

Express VS Graph_Objects

First of all ,there are two ways to use plotly in python: plotly.express and plotly.graph_objects. Plotly Express is a terse, consistent, high-level wrapper around plotly.graph_objects for rapid data exploration and figure generation.

WebGL VS SVG

Another thing to be noticed is that for data with large size, it’s better to use WebGL with Scattergl() in place of Scatter() for increased speed, improved interactivity, and the ability to plot even more data.

Use in Jupyter notebook

To plot figures in jupyter notebook, it’s crucial to add the following command:

from plotly.offline import init_notebook_mode, iplot init_notebook_mode(connected=True)

ScatterPlot

import plotly.express as px

#show pic in notebook

init_notebook_mode(connected=True)

fig = px.scatter(df_lowImp, x="imp_mean", y="imp_std",

color="type",opacity=0.5,

hover_data=['ip','type'])

fig.show()

import plotly.graph_objects as go

fig = go.Figure() fig.add_trace(

go.Scattergl(

x = df_highImp_mob.imp_mean,

y = df_highImp_mob.imp_std,

mode='markers',

name='all',

#marker_color=(df_highImp_mob.mean_imp > 1),

text=df_highImp_mob.mean_imp,

opacity=0.5,

marker = dict(

color=df_highImp_mob.mean_imp,

cmax=5,

cmin=0,

line = dict(width = 1),

)

)

) fig.add_trace(

go.Scattergl(

x = df_mobileWhite.imp_mean,

y = df_mobileWhite.imp_std,

mode='markers',

name='whiteIP',

text=df_highImp_mob.mean_imp,

opacity=0.5,

marker = dict(

size=8,

color='red',

line = dict(width = 1),

)

)

) fig.update_xaxes(title_text='imp mean')

fig.update_yaxes(title_text='imp std') fig.show()

3D Scatter Plot

The figure below can be used as 3D heatmap to show 3d joint distributions.

import plotly.express as px

#show pic in notebook

init_notebook_mode(connected=True)

fig = px.scatter_3d(df_test, x='N4/N1(%)', y='N5/N2(%)', z='N6/N3(%)',color='IP_NUM',size='IP_NUM')

fig.show()

LinePlot

import plotly.graph_objects as go fig = go.Figure() for vender in temp.columns:

fig.add_trace(

go.Scatter(

x = temp.index,

y = temp[vender],

name=vender,

marker = dict(

line = dict(

width = 1,

color = 'DarkSlateGrey')

)

)

)



fig.show()

BarPlot

import plotly.graph_objects as go fig = go.Figure()

fig.add_trace(

go.Bar(

x = list(pd.DataFrame(df_highImp['provience'].value_counts()).index),

y = pd.DataFrame(df_highImp['provience'].value_counts()).iloc[:,0]

))

fig.show()

animals=['giraffes', 'orangutans', 'monkeys']



fig = go.Figure(data=[

go.Bar(name='SF Zoo', x=animals, y=[20, 14, 23]),

go.Bar(name='LA Zoo', x=animals, y=[12, 18, 29])

])

# Change the bar mode

fig.update_layout(barmode='group')

fig.show()

Histogram

import plotly.express as px

df = px.data.tips()

fig = px.histogram(df, x="total_bill")

fig.show()

more: https://plot.ly/python/histograms/

(other types of charts to be continued)
Introducing Plotly for Interactive Visualizations
By: Rochisha Agarwal
Tags: Data Science, Plotly, Visualization, Python, Data Analysis

My journey with visualizations began as soon as I entered the field of Data Science. Charts and graphs play an integral role when you want to analyze and interpret the data. Visualization plays a key role to understand a complex dataset through a form of an image that is easier to understand by the brain. Visuals tell a story of the data and convey a comprehensive meaning.

The product at my internship I had been working on recently, required me to visualize this huge chunk of data. It had around a million points. It came to me as a mammoth task as a beginner in the field.

My senior particularly said that he wanted interactive visualizations for the dataset which could be directly delivered to the client. It put me in this puzzling situation as I always used Matplotlib and Seaborn for the data analysis and it sure was anything but interactive.

After spending a lot of time researching various tools for data visualization, I came across the best, Plotly.

(Disclaimer: It was the best for my task. But I assure you it works well with all kinds of tasks.)
Installing Docker for Windows.
By: Leonardo Solorzano Carrasquero
Tags: Docker, Installation, Windows 10

Docker for Windows 10.

In the following minutes, I will be guiding you across a Step-By-Step guide where you will learn how to install Docker in Windows for you to start simplifying your life as a developer, lets get started!.

You may be asking yourself, what’s Docker? in that case, just look at this post where I explain what’s Docker and what it is used for. Now, the first thing you need to know about Docker for Windows, is that for it to be installed you need to have a Windows 10 Pro or Enterprise, because Docker uses a virtualization which is only available since Windows 10.

In case you don’t have Windows 10 you can go to Docker’s documentation and download Docker’s Toolbar which will allow you to use Docker without Windows 10 (I wont cover this in the guide because the result is not the best and you get a better experience from Windows 10).

This explained, lets proceed:

Go to Docker’s home page.

Docker’s Home Page (03/16/2019).

2. Hover Products section on the menu bar.

Docker’s Desktop (03/16/2019).

3. Click on Docker Desktop.

Selecting OS (03/16/2019).

4. Click on Download for Windows.

Getting Docker .exe for Windows (03/16/2019).

5. Click on Get Docker.

6. Execute the downloaded .exe file.

Docker’s .exe for Windows (03/16/2019).

7. Docker will start downloading needed packages and files, after the download and install is completed you will get this screen.

Docker’s Configuration panel (03/16/2019).

8. I will un-check the “Add shortcut to desktop” option because otherwise I always finish messing up my desktop, and click Ok.

9. Docker will start unpacking files and then will ask you to log out of Windows to complete the installation.

Docker’s Installation succeeded screen (03/16/2019).

10. Then when you log in again, Docker will ask you to enable Hyper-V which is the feature from Windows 10 I commented you early in the post, after that, your computer may restart one or several times.

Docker’s Hyper-V screen (03/16/2019).

11. The next time you start your computer, you will have Docker completely installed and configured in your machine and you will see this interface.

Docker’s User interface (03/16/2019).

CONGRATULATIONS! If you reached this point it means you have installed Docker on your machine, don’t believe me? try it yourself!:

Execute cmd.exe. Write “Docker run hello-world”. Wait and see how magic happens.

This, is the very beginning of your process to simplify the development of your apps, I hope you can find in this tool the way to improve your developing experience, Be creative, be graphical, have fun, and keep coding! see you soon!.
How to Add Extension Files in Microsoft Edge
By: Neha Goklani
Tags: Windows 10

The most effective method to Add Extension Files in Microsoft Edge

You can introduce Microsoft Edge expansions from sources other than the official Windows Store. In this guide, we demonstrate to you how.

tarting with the Windows 10 Anniversary Update, Microsoft Edge incorporates support for augmentations, which are little projects proposed to include new highlights and upgrade the internet browser experience.

Microsoft makes these augmentations accessible through the Windows Store, but on the other hand it’s conceivable to introduce them physically. For instance, in case you’re an engineer endeavoring to test an expansion you made, or you need to introduce a beta rendition of an official augmentation that isn’t accessible in the Store, you can introduce them all alone.

In this Windows 10 direct, we’ll walk you through the means to introduce augmentations on Microsoft Edge from sources other than the Store.

The most effective method to introduce Edge augmentations that don’t originate from the Windows Store. Make your pc virus free with mcafee activate services.

In the event that you need to stack an expansion that isn’t accessible in the Store, you can utilize these means:

Open Microsoft Edge.

In the location bar, type about:flags, and press Enter.

Check the Enable expansion designer highlights choice.

Close and restart the internet browser.

Select the menu (…) catch on the upper right corner.

Select Extensions.

Snap the Load augmentations catch.also you can download

Peruse to the envelope with the expansion you need to sideload, and after that click the Select organizer catch.

When you complete these means, you can begin utilizing the expansion as you would whatever other augmentation that you got from the Store. You’ll likewise see that not at all like normal expansions, those you introduce from outside the Store have an extra choice on the off chance that you have to reload the augmentation.

On the off chance that you need to expel the expansion from Microsoft Edge, basically right-click it, and select the Remove catch. On the off chance that you need to incapacitate the component, pursue similar advances, yet on step №3, clear the check box for the Enable augmentation designer highlights choice.

While it’s conceivable to introduce any expansion from sources other than the Store, for example, the Turn Off the Light augmentation, you should just load those from sources you trust. Else, you could put your gadget or information in danger.

More Windows 10 assets

For more help articles, inclusion, and answers to basic inquiries regarding Windows 10, visit the accompanying assets:

Windows 10 on Windows Central — All you have to know

Windows 10 help, tips, and traps

Windows 10 gatherings on Windows Central
Download SHAREit Free For APK/Android
By: Zuraida Ida
Tags: Mac, Windows 10, Android, Android Apps, iOS

Download SHAREit Free For APK

SHAREit for Android is an application to share files and documents. SHAREit is a cross platform application close. Share app has been used more than 600 million people in the world.

To use SHAREit for Android no internet connection needed when performing a file transfer.

Main Features

Fast and free: SHAREit for Android has the advantage in speed of transfer and without the need to connect the internet. The delivery process is done through Bluetooth, high-speed up to 20 MB per second. All files sent using SHAREit will not experience loss of quality, so You can keep the quality of photos, videos, music tracks, and important documents belonging to You.

Support all file formats: SHAREit for Android can be used to send or receive all sorts of file formats. You can do the delivery of smartphones, tablets, iOs and PC or computer. Because SHAREit for Android this is a cross platform application.

Intuitive interface: the Application SHAREit for Android comes with an intuitive interface and easy to use. All the menus and the available options will be very easy to understand. The process of file transfer from one device to another will be easy to do.

SHAREit for Android the latest version can now manage and analyze files apps with the. APK format.
📚 How to Translate Text from Photo 🗺, Voice, Dialogue or Handwriting with Google Translate
By: Hetman Software
Tags: Windows 10, Android, Google, Translate, Windows

👍 In today’s video, I’ll show you how to translate text from camera, a dialogue, a voice message and handwriting with the help of Google Translate mobile app. It’s difficult to underestimate the importance of this translation service, but most people tend to use only the standard translation window in the Google Translate app and overlook additional functions and features that can make things much easier for a tourist or even a common user. If you have ever used this translation service, today’s video can be useful. In a few seconds, I’ll show you in detail what Google Translate can do.

👉What Are Errors 400, 403, 404, 500, 502, 503 and How to Fix Them: https://hetmanrecovery.com/recovery_n...

That is all for now! Hopefully, this video was useful. Remember to click the Like button and subscribe to our channel. Hit the bell button to receive notifications and never miss new videos. Leave comments to ask questions. Thank you for watching. Good luck.

This and other videos you can watch on our YouTube channel: https://www.youtube.com/user/hetmansoftwareworld/
Why do users need to update Windows 10
By: Techno Odisha
Tags: Techno Odisha, How To Update Windows 10, Windows 10

Microsoft removes the last Windows 10 upgrade blocks: Why users need to update

The company has now updated its Windows 10 20H2 and Windows Server 20H2 documents to let users know that they can now update their Windows 10 installation to the latest version.

The company has now updated its Windows 10 20H2 and Windows Server 20H2 documents to let users know that they can now update their Windows 10 installation to the latest version.

Ahead of the upcoming 21H1 May Windows 10 update scheduled for release in the coming weeks, Microsoft has announced that it will finally remove the final roadblocks to update the Windows 10 release in October — also known as the 20H2 update.

The company regularly puts ‘blocks’ on the development of the latest Windows release for specific device models to hardware internally.

This is usually due to some incompatible driver or other software issues that may prevent users from successfully developing. Until Microsoft or the device manufacturer fixes the issues, the user cannot update to that version of Windows.

Microsoft has now updated its Windows 10 20H2 and Windows Server 20H2 versions to let users know that they can now update Windows 10 to the latest version, from older versions like the 2004 release and the 1909 release two years ago. Microsoft will discontinue support for older versions, making removal of these updates a preventable movement.

Some of these problems solved by Microsoft include issues with Conexant audio drivers, poor game performance, Microsoft Edge loss in some installations, and printing problems with missing color from printers, issues with Microsoft Office, Thunderbolt NVMe SSD, and issues, and Chinese language issues.

We have previously reported that users of older versions of Windows 10 should upgrade to the latest version of 20H2 and eat first as Microsoft will reject support for Windows 10 versions released in November 2019, October 2018, and April 2018. -October 2020, while the upcoming May 2021 update should come later this month.