Show Sidebar Hide Sidebar

Make a Chart with an Inset Plot with Plotly and Excel

Chart with an Inset Plot with Plotly

Step 1

Upload your Excel data to Plotly's grid

Open the data file for this tutorial in Excel. You can download the file here in CSV format

Excel view

Step 2

Head to Plotly

Head to Plotly's Workspace and sign into your free Plotly account. Go to 'Import,' click 'Upload a file,' then choose your Excel file to upload. Your Excel file will now open in Plotly's grid. For more about Plotly's grid, see this tutorial

Import data

Step 3

Creating Your Chart

Label your columns like we did below. You'll have three different x-y datasets (margin of error, photon density/energy, electron energy/density). Select 'Line plots' from the MAKE A PLOT menu and then click line plot in the bottom left.

Grid

Your plot would initially look something like this.

Original

Head to the TRACES popover and access Col5 from the dropdown menu. From 'Axes' you'll want to click New Axis/Subplot bar. From New Axis/Subplot you'll want to click 'Inset' under New Subplot.

Create Inset

Your plot would then look something like this.

Plotting

Take a moment to resize your plot to something less wide. A width of 800 and a height of 600 seems reasonable. Head to the layout menu to do this.

Resize

Now, head to the TRACES popover again and access Col1 from the dropdown menu. For these data points, you'll want to remove the line from the marker. This will get you a plot closer to our version.

Data Points

Then, within the same popover and column, head to the error bar menu. Show both the x and y error bars. You'll immediately notice the change on your graph.

Error Bars

You can play with the 'Value' option within the error bar menu to get the bars to a length of your liking.

Step 4

Finalizing Your Graph

Adding titles to the x and y axis of your original plot and inset plot are important, as is an overall title for your plot. After titling your plot, it should look something like this.

Titles

Head to the LEGEND popover. From there, you can hide your legend; it isn't really an important part of this graph.

Legend

You might notice that the grid lines on the inset plot clash with the grid lines of your original plot. Head to the AXES popover, then select X Axis 2 (Y Axis 2) from the drop down menu. Head to 'lines' and turn the grid lines off.

Grid Lines off Y

In order to get a distinguished inset 'boxed-in' look, you can turn the Axis line and Mirror on in the case of X Axis 2 (Y Axis 2) and also turn the Zero line off in both cases.

Axis Line/Mirror Y

Step 5

Finalizing your Graph

Your plot should now look something like this. In order to get the graph at the top of the tutorial, you’ll need to style it a little more.

Final

We used a note to link to our source data. You can download your finished Plotly graph to embed in your Excel workbook. We also recommend including the Plotly link to the graph inside your Excel workbook for easy access to the interactive Plotly version. Get the link to your graph by clicking the 'Share' button. Download an image of your Plotly graph by clicking EXPORT on the toolbar.

To add the Excel file to your workbook, click where you want to insert the picture inside Excel. On the INSERT tab inside Excel, in the ILLUSTRATIONS group, click PICTURE. Locate the Plotly graph image that you downloaded and then double-click it. Notice that we also copy-pasted the Plotly graph link in a cell for easy access to the interactive Plotly version.

Excel workbook

Still need help?
Contact Us

For guaranteed 24 hour response turnarounds, upgrade to our Premium or Enterprise plans.