Added an article
plotting in log scale
@ -286,7 +286,7 @@ maxuploadtarget=5000
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -161,7 +161,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
BIN
images/Plotting+data+using+log+axis/output_11_0.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
images/Plotting+data+using+log+axis/output_12_0.png
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
images/Plotting+data+using+log+axis/output_13_0.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
images/Plotting+data+using+log+axis/output_6_0.png
Normal file
|
After Width: | Height: | Size: 87 KiB |
BIN
images/Plotting+data+using+log+axis/output_7_0.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
images/Plotting+data+using+log+axis/output_8_0.png
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
images/Plotting+data+using+log+axis/output_9_0.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
@ -294,6 +294,7 @@
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ul>
|
||||
<li><a href="./python/logplot.html">Plotting data using log axis</a></li>
|
||||
<li><a href="./python/Setting_up_the_notebook_for_plotting_with_matplotlib.html">Setting up the notebook for plotting with matplotlib</a></li>
|
||||
<li><a href="./python/Saving_a_matplotlib_figure_with_a_high_resolution.html">Saving a matplotlib figure with a high resolution</a></li>
|
||||
</ul>
|
||||
@ -528,7 +529,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -144,7 +144,7 @@ However, you can use the following command to do it </p>
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -143,7 +143,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -158,7 +158,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -151,7 +151,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -1033,7 +1033,7 @@ Top dislike features:
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -145,7 +145,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -193,7 +193,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -235,7 +235,7 @@ At line 5 there is a plum which is purple and contains 28 kcal
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -379,7 +379,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -169,7 +169,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -193,7 +193,7 @@ If you try to open a non existing file in read mode 'r', a FileNotFoundError wil
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -238,7 +238,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -186,7 +186,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -171,7 +171,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -340,7 +340,7 @@ However, exporting to a sql database can prove very useful. Indeed, having a wel
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -219,7 +219,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
297
python/logplot.html
Normal file
@ -0,0 +1,297 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
<meta name="description" content="Data Science for Political and Social Phenomena">
|
||||
<meta name="author" content="Guillaume Redoulès">
|
||||
<link rel="icon" href="../favicon.ico">
|
||||
|
||||
<title>Plotting data using log axis - Python</title>
|
||||
|
||||
<!-- JQuery -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
||||
<script>
|
||||
window.jQuery || document.write('<script src="../theme/js/jquery.min.js"><\/script>')
|
||||
</script>
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link rel="stylesheet" href="../theme/css/bootstrap.css" />
|
||||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
|
||||
<link rel="stylesheet" type="text/css" href="../theme/css/ie10-viewport-bug-workaround.css" />
|
||||
<!-- Custom styles for this template -->
|
||||
<link rel="stylesheet" type="text/css" href="../theme/css/style.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../theme/css/notebooks.css" />
|
||||
<link href='https://fonts.googleapis.com/css?family=PT+Serif:400,700|Roboto:400,500,700' rel='stylesheet' type='text/css'>
|
||||
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
<meta name="tags" content="Data Visualization" />
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="..">Guillaume Redoulès</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse" id="searchbar">
|
||||
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">About<span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="../pages/about.html">About Guillaume</a></li>
|
||||
<li><a href="https://github.com/redoules">GitHub</a></li>
|
||||
<li><a href="https://www.linkedin.com/in/guillaume-redoul%C3%A8s-33923860/">LinkedIn</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Data Science<span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="..#Blog">Blog</a></li>
|
||||
<li><a href="..#Python">Python</a></li>
|
||||
<li><a href="..#Bash">Bash</a></li>
|
||||
<li><a href="..#SQL">SQL</a></li>
|
||||
<li><a href="..#Mathematics">Mathematics</a></li>
|
||||
<li><a href="..#Machine_Learning">Machine Learning</a></li>
|
||||
<li><a href="..#Projects">Projects</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Projects<span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="https://github.com/redoules/redoules.github.io">Notes (Github)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!--<li class="dropdown">
|
||||
<a href="../feeds/blog.rss.xml">Blog RSS</a>
|
||||
</li>-->
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
<form class="navbar-form" action="../search.html" onsubmit="return validateForm(this.elements['q'].value);">
|
||||
<div class="form-group" style="display:inline;">
|
||||
<div class="input-group" style="display:table;">
|
||||
<span class="input-group-addon" style="width:1%;"><span class="glyphicon glyphicon-search"></span></span>
|
||||
<input class="form-control search-query" name="q" id="tipue_search_input" placeholder="e.g. scikit KNN, pandas merge" required autocomplete="off" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- end of header section -->
|
||||
<div class="container">
|
||||
<!-- <div class="alert alert-warning" role="alert">
|
||||
Did you find this page useful? Please do me a quick favor and <a href="#" class="alert-link">endorse me for data science on LinkedIn</a>.
|
||||
</div> -->
|
||||
<section id="content" class="body">
|
||||
<header>
|
||||
<h1>
|
||||
Plotting data using log axis
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<time class="published" datetime="2018-08-06T16:34:00+02:00">
|
||||
06 août 2018
|
||||
</time>
|
||||
</li>
|
||||
<li>Python</li>
|
||||
<li>Data Visualization</li>
|
||||
</ol>
|
||||
</header>
|
||||
<div class='article_content'>
|
||||
<h1>Plotting in log axis with matplotlib</h1>
|
||||
<div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="kn">as</span> <span class="nn">plt</span>
|
||||
<span class="o">%</span><span class="n">matplotlib</span> <span class="n">inline</span>
|
||||
|
||||
|
||||
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
|
||||
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
|
||||
<span class="n">y</span> <span class="o">=</span> <span class="mi">20</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">exp</span><span class="p">(</span><span class="o">-</span><span class="n">x</span><span class="o">/</span><span class="mf">10.0</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<h2>Plotting using the standard function then specifying the axis scale</h2>
|
||||
<p>One of the easiest way to plot in a log plot is to specify the plot normally and then specify which axis is to be plotted with a log scale.</p>
|
||||
<p>This can be specified by the function set_xscale or set_yscale</p>
|
||||
<div class="highlight"><pre><span></span><span class="c1"># Normal plot</span>
|
||||
<span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">()</span>
|
||||
<span class="n">ax</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">grid</span><span class="p">()</span>
|
||||
|
||||
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p><img alt="png" src="../images/Plotting+data+using+log+axis/output_6_0.png"></p>
|
||||
<div class="highlight"><pre><span></span><span class="c1"># Log x axis plot</span>
|
||||
<span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">()</span>
|
||||
<span class="n">ax</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">set_xscale</span><span class="p">(</span><span class="s1">'log'</span><span class="p">)</span>
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">grid</span><span class="p">()</span>
|
||||
|
||||
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p><img alt="png" src="../images/Plotting+data+using+log+axis/output_7_0.png"></p>
|
||||
<div class="highlight"><pre><span></span><span class="c1"># Log x axis plot</span>
|
||||
<span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">()</span>
|
||||
<span class="n">ax</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">set_yscale</span><span class="p">(</span><span class="s1">'log'</span><span class="p">)</span>
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">grid</span><span class="p">()</span>
|
||||
|
||||
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p><img alt="png" src="../images/Plotting+data+using+log+axis/output_8_0.png"></p>
|
||||
<div class="highlight"><pre><span></span><span class="c1"># Log x axis plot</span>
|
||||
<span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">()</span>
|
||||
<span class="n">ax</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">set_xscale</span><span class="p">(</span><span class="s1">'log'</span><span class="p">)</span>
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">set_yscale</span><span class="p">(</span><span class="s1">'log'</span><span class="p">)</span>
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">grid</span><span class="p">()</span>
|
||||
|
||||
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p><img alt="png" src="../images/Plotting+data+using+log+axis/output_9_0.png"></p>
|
||||
<h2>Plotting using the matplotlib defined function</h2>
|
||||
<p>Matplotlib has the function : semilogx, semilogy and loglog that can help you avoid having to specify the axis scale.</p>
|
||||
<div class="highlight"><pre><span></span><span class="c1"># Plot using semilogx</span>
|
||||
<span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">()</span>
|
||||
<span class="n">ax</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">semilogx</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">grid</span><span class="p">()</span>
|
||||
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p><img alt="png" src="../images/Plotting+data+using+log+axis/output_11_0.png"></p>
|
||||
<div class="highlight"><pre><span></span><span class="c1"># Plot using semilogy</span>
|
||||
<span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">()</span>
|
||||
<span class="n">ax</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">semilogy</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">grid</span><span class="p">()</span>
|
||||
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p><img alt="png" src="../images/Plotting+data+using+log+axis/output_12_0.png"></p>
|
||||
<div class="highlight"><pre><span></span><span class="c1"># Plot using loglog</span>
|
||||
<span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">()</span>
|
||||
<span class="n">ax</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">loglog</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
|
||||
|
||||
<span class="n">ax</span><span class="o">.</span><span class="n">grid</span><span class="p">()</span>
|
||||
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p><img alt="png" src="../images/Plotting+data+using+log+axis/output_13_0.png"></p>
|
||||
</div>
|
||||
<aside>
|
||||
<div class="bug-reporting__panel">
|
||||
<h3>Find an error or bug? Have a suggestion?</h3>
|
||||
<p>Everything on this site is avaliable on GitHub. Head on over and <a href='https://github.com/redoules/redoules.github.io/issues/new'>submit an issue.</a> You can also message me directly by <a href='mailto:guillaume.redoules@gadz.org'>email</a>.</p>
|
||||
</div>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<!-- start of footer section -->
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
</center>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- This jQuery line finds any span that contains code highlighting classes and then selects the parent <pre> tag and adds a border. This is done as a workaround to visually distinguish the code inputs and outputs -->
|
||||
<script>
|
||||
$( ".hll, .n, .c, .err, .k, .o, .cm, .cp, .c1, .cs, .gd, .ge, .gr, .gh, .gi, .go, .gp, .gs, .gu, .gt, .kc, .kd, .kn, .kp, .kr, .kt, .m, .s, .na, .nb, .nc, .no, .nd, .ni, .ne, .nf, .nl, .nn, .nt, .nv, .ow, .w, .mf, .mh, .mi, .mo, .sb, .sc, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss, .bp, .vc, .vg, .vi, .il" ).parent( "pre" ).css( "border", "1px solid #DEDEDE" );
|
||||
</script>
|
||||
|
||||
|
||||
<!-- Load Google Analytics -->
|
||||
<script>
|
||||
/*
|
||||
(function(i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r;
|
||||
i[r] = i[r] || function() {
|
||||
(i[r].q = i[r].q || []).push(arguments)
|
||||
}, i[r].l = 1 * new Date();
|
||||
a = s.createElement(o),
|
||||
m = s.getElementsByTagName(o)[0];
|
||||
a.async = 1;
|
||||
a.src = g;
|
||||
m.parentNode.insertBefore(a, m)
|
||||
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
||||
|
||||
ga('create', 'UA-66582-32', 'auto');
|
||||
ga('send', 'pageview');
|
||||
*/
|
||||
</script>
|
||||
<!-- End of Google Analytics -->
|
||||
|
||||
<!-- Bootstrap core JavaScript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="../theme/js/bootstrap.min.js"></script>
|
||||
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
|
||||
<script src="../theme/js/ie10-viewport-bug-workaround.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -382,7 +382,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -151,7 +151,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -112,7 +112,7 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -5,7 +5,7 @@ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
|
||||
<url>
|
||||
<loc>redoules.github.io/</loc>
|
||||
<lastmod>2018-08-05T10:53:43-00:00</lastmod>
|
||||
<lastmod>2018-08-06T16:49:52-00:00</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>0.5</priority>
|
||||
</url>
|
||||
@ -17,6 +17,13 @@ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<priority>0.5</priority>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>redoules.github.io/python/logplot.html</loc>
|
||||
<lastmod>2018-08-06T16:34:00+02:00</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.5</priority>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>redoules.github.io/python/download_page.html</loc>
|
||||
<lastmod>2018-08-05T10:47:00+02:00</lastmod>
|
||||
|
||||
@ -344,7 +344,7 @@ Done.
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -631,7 +631,7 @@ Done.
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -216,7 +216,7 @@ Done.
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||
@ -346,7 +346,7 @@ Done.
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">
|
||||
<center>This project contains 23 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<center>This project contains 24 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||
<br/>
|
||||
Copyright © Guillaume Redoulès,
|
||||
<time datetime="2018">2018</time>.
|
||||
|
||||