<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Adil Baaj on Medium]]></title>
        <description><![CDATA[Stories by Adil Baaj on Medium]]></description>
        <link>https://medium.com/@AdilBaaj?source=rss-2bd3ab99a5af------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*qqGP40fsg8oGolnz.jpg</url>
            <title>Stories by Adil Baaj on Medium</title>
            <link>https://medium.com/@AdilBaaj?source=rss-2bd3ab99a5af------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 15:34:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@AdilBaaj/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Keras Tutorial: Content Based Image Retrieval Using a Convolutional Denoising Autoencoder]]></title>
            <link>https://medium.com/sicara/keras-tutorial-content-based-image-retrieval-convolutional-denoising-autoencoder-dc91450cc511?source=rss-2bd3ab99a5af------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc91450cc511</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Adil Baaj]]></dc:creator>
            <pubDate>Thu, 14 Sep 2017 13:24:34 GMT</pubDate>
            <atom:updated>2019-12-06T13:52:26.906Z</atom:updated>
            <content:encoded><![CDATA[<p>Read the original article on Sicara’s blog <a href="https://www.sicara.ai/blog/2017-09-14-keras-tutorial-content-image-retrieval-convolutional-denoising-autoencoder">here</a>.</p><p><strong>Content based image retrieval</strong> (CBIR) systems enable to find similar images to a query image among an image dataset. The most famous CBIR system is the search per image feature of Google search. This article uses the <a href="https://keras.io/"><strong>keras</strong></a><strong> deep learning framework to perform image retrieval on the </strong><a href="http://yann.lecun.com/exdb/mnist/"><strong>MNIST dataset</strong></a>.</p><p>Our CBIR system will be based on a <strong>convolutional denoising autoencoder</strong>. It is a class of <strong>unsupervised deep learning</strong> algorithms.</p><h3>Content based image retrieval</h3><p>To explain what content based image retrieval (CBIR) is, I am going to quote this <a href="http://www.baskent.edu.tr/~hogul/RA1.pdf">research paper</a>.</p><blockquote><em>There are two [image retrieval] frameworks: text-based and content-based. The text-based approach can be tracked back to 1970s. In such systems, the images are manually annotated by text descriptors, which are then used by a database management system to perform image retrieval. There are two disadvantages with this approach. The first is that a considerable level of human labour is required for manual annotation. The second is the annotation inaccuracy due to the subjectivity of human perception. To overcome the above disadvantages in text-based retrieval system, content-based image retrieval (CBIR) was introduced in the early 1980s. </em><strong><em>In CBIR, images are indexed by their visual content, such as color, texture, shapes.</em></strong></blockquote><p>Basically we first <strong>extract features </strong>from an image database and store it. Then we compute the features associated with a <strong>query image. </strong>Finally we <strong>retrieve images with the closest features</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A8XGoiRfGusTxdfmglrKww.png" /></figure><h3>Feature extraction for content based image retrieval</h3><p>The <strong>key point</strong> about content based image retrieval is the <strong>feature extraction</strong>. The features correspond to the way we represent an image on a high level. How to describe the colours on an image? Its texture? The shapes on it? The features we extract should also allow an efficient retrieval of the images. This is especially true if we have a big image database.</p><p>There are many ways to extract these features.</p><p>One way is to use what we call <strong>hand crafted features</strong>. Examples are: <a href="https://en.wikipedia.org/wiki/Color_histogram"><strong>histogram of colours</strong></a><strong> </strong>to define colours, <a href="https://en.wikipedia.org/wiki/Histogram_of_oriented_gradients"><strong>histogram of oriented gradients</strong></a><strong> </strong>to define shapes.</p><p>Other descriptors like <a href="https://en.wikipedia.org/wiki/Scale-invariant_feature_transform"><strong>SIFT</strong></a> and <a href="https://en.wikipedia.org/wiki/Speeded_up_robust_features"><strong>SURF</strong></a> have proven to be robust for image retrieval applications.</p><p>Another possibility is to use deep learning algorithms. In this <a href="https://arxiv.org/pdf/1404.1777.pdf">research paper</a> the authors demonstrate that <a href="http://cs231n.github.io/convolutional-networks/"><strong>convolutional neural networks</strong></a> (CNN) trained for classification purposes can be used to extract a ‘neural code’ for images. These neural codes are the features used to describe images. It also demonstrates that it performs as well as state of the art approaches on many datasets. The problem about this approach is that we first need labelled data to train the neural network. <strong>The labelling task can be costly and time consuming</strong>. Another way to generate these ‘neural codes’ for our image retrieval task is to use an unsupervised deep learning algorithm. This is where the <strong>denoising autoencoder</strong> comes.</p><h3>Denoising autoencoder</h3><p>A <strong>denoising autoencoder</strong> is a <strong>feed forward neural network that learns to denoise images</strong>. By doing so the neural network learns interesting features on the images used to train it. Then <strong>it can be used to extract features</strong> from similar images to the training set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G0V4dz4RKTKGpebeoSWB0A.png" /></figure><p>If you are not familiar with autoencoders, I highly recommend to first browse these three sources:</p><ul><li><a href="http://www.deeplearningbook.org/">Deep learning book</a></li><li>Course <a href="https://www.youtube.com/watch?v=FzS3tMl4Nsc">videos</a> by Hugo Larochelle</li><li><a href="https://blog.keras.io/building-autoencoders-in-keras.html">Autoencoder keras tutorial</a></li></ul><h3>Denoising autoencoder for content based image retrieval</h3><p>We use the convolutional denoising autoencoder algorithm provided on <a href="https://blog.keras.io/building-autoencoders-in-keras.html">keras</a> tutorial.</p><h4>Training the model</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a37bef5b15c9782a6548bd5c7b163a4/href">https://medium.com/media/0a37bef5b15c9782a6548bd5c7b163a4/href</a></iframe><p>For the general explanations on the above lines of code please refer to <a href="https://blog.keras.io/building-autoencoders-in-keras.html">keras tutorial</a>.</p><p>Notice that there are small differences compared to the tutorial. The first difference is this line:</p><pre>encoded = MaxPooling2D((2, 2), padding=&#39;same&#39;, name=&#39;encoder&#39;)(x)</pre><p>We set a name to the encoder layer in order to be able to access it.</p><p>We also saved the learned model by adding:</p><pre>autoencoder.save(&#39;autoencoder.h5&#39;)</pre><p>This will enable us to load it later in order to test it.</p><p>Finally, we reduced the number of epochs from 100 to 20 in order to save time :).</p><h4>Denoising an image</h4><p>Let’s try our learned model to denoise an input test image.</p><p>First we regenerate the noisy data and load the previously trained autoencoder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a405206214b7b0ccc8a77a35f370b9c6/href">https://medium.com/media/a405206214b7b0ccc8a77a35f370b9c6/href</a></iframe><p>Then we call the following function that denoises the first noisy test image and plot it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da9d96537af02246aac6dc83b291a7d5/href">https://medium.com/media/da9d96537af02246aac6dc83b291a7d5/href</a></iframe><p>The result is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*Ontq0fsdqOmNLzznPYg75A.jpeg" /><figcaption>Noisy image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*GDXkINmL31jHWcCKK75Rqw.jpeg" /><figcaption>Denoised image</figcaption></figure><h4>Computing the features of the training dataset</h4><p>Our image database is the MNIST training dataset.</p><p>Our goal is to <strong>provide a query image and find the closest MNIST images</strong>.</p><p>First, <strong>we compute the features of the training dataset and the query images</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b32468d2c385fc1369948632a30b3286/href">https://medium.com/media/b32468d2c385fc1369948632a30b3286/href</a></iframe><h4>Scoring function</h4><p>Before scoring our model we need to understand the scoring function we will use.</p><p>To assess the model, we use the <a href="http://scikit-learn.org/stable/">scikit learn</a> <strong>function: </strong><a href="http://scikit-learn.org/stable/modules/generated/sklearn.metrics.label_ranking_average_precision_score.html"><strong>label_ranking_average_precision_score</strong></a>. This function takes two arrays as input. First an array of zeros and ones. Second an array of relevance scores.</p><p>In our case, we compute the relevance score from the computed distance between the feature of the query image and the images of the database. The lower the distance the higher the relevance score should be.</p><p>We construct the first array following this rule: for each image on database, if the image has the same label as the query image, we append a ‘1’ to the array. Otherwise we append a ‘0’.</p><p>This scoring function <strong>returns a maximum score of 1 if the closest images have the same label as the query image</strong>. If there are images with a different label that are closer to the query image, the score decreases.</p><p>To get a feel of what it does let’s compute the value of this scoring function on some examples.</p><p>Suppose we have a query image with label ‘7’ and that we have four images in our database with following labels : ‘7’, ‘7’, ‘1’, ‘0’. The first two images of the database are relevant regarding the query image, and the two last ones are not. The first array that we pass to the scoring function should be [1, 1, 0, 0]. For each image on our image database we will compute a relevance score:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c61772e0d45f843f1f61e4aa9c20e11/href">https://medium.com/media/5c61772e0d45f843f1f61e4aa9c20e11/href</a></iframe><h4>Scoring the model</h4><p><strong>For each query image feature, we compute the Euclidian distance to the training dataset images features</strong>. The closer the distance the higher the relevance score should be. Then we apply the scoring function label_ranking_average_precision_score to our results.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/30287236c65a45b35765af2892f0d100/href">https://medium.com/media/30287236c65a45b35765af2892f0d100/href</a></iframe><h4>Results</h4><p>The y axis correspond to the score computed with the label ranking average precision scoring function. The x axis corresponds to the n first results assessed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ehUp-nzBF2sEC_97Dhl3lw.png" /></figure><p>To better understand this graph I will give an example. Suppose we have a database of 3images with labels 7, 7, 1 . And suppose the input image has a label 7. If our algorithm sorts the results on the following order: 7, 1, 7. First we will score only the first returned image [7]: the scoring function returns 1. Then we assess the first two images returned [7, 1]: the scoring function return 1. Then we assess the first three results [7, 1, 7]: the score decreases and is now equal to 0.83 etc…</p><p><strong>Overall the more retrieved images we assess the worse the score is</strong>.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*7DlcU2hgBAi48B7lBudNPg.png" /><figcaption>Query image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ijrCGyhP98M1Gr72e_gIw.png" /><figcaption>First 10 retrieved images</figcaption></figure><p>You can find the full code <a href="https://github.com/AdilBaaj/unsupervised-image-retrieval">here</a>.</p><h3>Conclusion</h3><p>We tested an image retrieval deep learning algorithm on a basic dataset. Our convolutional denoising autoencoder is efficient when considering the first retrieved images. But we tested it on similar images. We didn’t have to deal with color, scaling and rotation issues.</p><h3>Want to go further?</h3><p>To learn more on autoencoders for CBIR you can read this <a href="http://www.cs.toronto.edu/~fritz/absps/esann-deep-final.pdf">research paper</a> from Alex Krizhevsky and Georey Hinton.</p><p>If you liked this article please share it or leave your feedback below.</p><p><strong>Want more articles like this one? Don’t forget to hit the Follow button!</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff40688%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Ff40688%2F&amp;image=https%3A%2F%2Fe.enpose.co%2F%3Fkey%3DdRXnS9Gplk%26w%3D700%26h%3D425%26url%3Dhttps%253A%252F%252Fupscri.be%252Ff40688%252F%253Fenpose&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/4832dea2286a7211b06f2907b8ed6dea/href">https://medium.com/media/4832dea2286a7211b06f2907b8ed6dea/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc91450cc511" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sicara/keras-tutorial-content-based-image-retrieval-convolutional-denoising-autoencoder-dc91450cc511">Keras Tutorial: Content Based Image Retrieval Using a Convolutional Denoising Autoencoder</a> was originally published in <a href="https://medium.com/sicara">Sicara&#39;s blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Compare the Best Javascript Chart Libraries]]></title>
            <link>https://medium.com/sicara/compare-best-javascript-chart-libraries-2017-89fbe8cb112d?source=rss-2bd3ab99a5af------2</link>
            <guid isPermaLink="false">https://medium.com/p/89fbe8cb112d</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[charts]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Adil Baaj]]></dc:creator>
            <pubDate>Tue, 27 Jun 2017 14:20:24 GMT</pubDate>
            <atom:updated>2019-12-05T11:31:21.134Z</atom:updated>
            <content:encoded><![CDATA[<h4>Chart.js, Highcharts, C3, NVD3, Plotly.js, Chartist, Victory</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d7dvz2Zh28hJbzYXmKsCcQ.png" /></figure><p>Read the original article on Sicara’s blog <a href="https://www.sicara.ai/blog/2017-06-27-compare-best-javascript-chart-libraries">here</a>.</p><p>In this article, I provide a decision tree to quickly decide which open source javascript charting library is right for your project. You can use <strong>any framework</strong> like <a href="https://reactjs.org/">React</a>, <a href="https://angular.io/">Angular</a>, <a href="https://angularjs.org/">AngularJS</a>, <a href="https://vuejs.org/">VueJS</a> or just use vanilla javascript. Links to the graph libraries for each framework are provided below.</p><p><strong>I purposely exclude </strong><a href="https://d3js.org/"><strong>D3.js</strong></a><strong> among the chart libraries</strong>. D3 is an awesome javascript library, but it has no “ready to ship” charts and graphs. If you want to learn about D3 you can read my article <a href="https://blog.sicara.com/a-starting-point-on-using-d3-with-react-869fdf3dfaf">A starting point on using D3 with React</a>. I will however list NVD3 which is a chart library built on top of D3.</p><p><strong><em>Edit:</em></strong><em> this post has been updated since its first publication. Last update: 09/11/2017</em></p><h3>Table of content</h3><ul><li><a href="https://blog.sicara.com/compare-best-javascript-chart-libraries-2017-89fbe8cb112d#70e4">The most used javascript chart libraries</a></li><li><a href="https://blog.sicara.com/compare-best-javascript-chart-libraries-2017-89fbe8cb112d#b6f7">Criteria to choose your javascript charting library</a></li><li><a href="https://blog.sicara.com/compare-best-javascript-chart-libraries-2017-89fbe8cb112d#8a92">How to choose your javascript charting library</a> — <strong>Read only the decision tree if you want to choose quickly</strong></li><li><a href="https://blog.sicara.com/compare-best-javascript-chart-libraries-2017-89fbe8cb112d#1072">Libraries links and code examples</a></li></ul><h3>The most used javascript chart libraries</h3><p>I reviewed all the libraries listed in the aforementioned <a href="https://cssauthor.com/javascript-charting-libraries/">blog post</a>. This post comes on the first page if you google ‘best javascript chart libraries’. I used this <a href="http://npmcharts.com/compare/chartjs,chartist,react-google-charts,zingchart,plotly.js,highcharts,fusioncharts,plottable,amcharts3,anychart,syncfusion-javascript,taucharts,vis,c3,n3-charts,sigma,metrics-graphics,webix,rickshaw,nvd3,uvCharts,as-jqplot,xcharts,flot,dygraphs,dc,dimple,flotr2,jenscript,victory">tool</a> to get the following graph. It represents the number of downloads per day of each library through <a href="https://www.npmjs.com/">npm</a> (the weekends were removed).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M6ETZ58B2Sai4bzYhOh2Gg.png" /></figure><p>Number of downloads with npm from 01/01/2017 to 08/07/2017 (determined from <a href="https://npm-stat.com/">here</a>):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JFiLt9pM4KG5Jiiz35PcBw.png" /></figure><p>In this article I focus on these seven libraries.</p><p>An important thing to know<strong>, Victory is a chart library usable only with React JS</strong>. The other libraries can be used with any front javascript framework.</p><h3>Criteria to choose your javascript charting library</h3><p>It is important to understand what your project needs are and how they will evolve. This way you will save precious time by working with the right libraries from the start.</p><p>There are many elements to consider that can be equally important:</p><ul><li><strong>License</strong> used by the libraries</li><li>The library <strong>enrichment and maintenance over time</strong>. This can be assessed through the libraries’ Github repository popularity and activity.</li><li>The <strong>visualization provided</strong> (2D, 3D, map, scientific, financial, and statistical charting)</li><li>The <strong>customization options</strong> on your charts (titles, legends, zoom, tooltip, responsiveness)</li><li><strong>Graph design </strong>is also important.<strong> </strong>But I believe it is mostly a matter personal taste. Therefore it will not be extensively reviewed. You can still find an example of how the bar charts look a the end of the article.</li></ul><p>Other criteria that are not (or partially) reviewed in this article: browsers compatibility and animation options.</p><p>Once you know what matters for your project, the next parts of the article will help you find the right library.</p><h3>How to choose your javascript charting library</h3><p>I have summed up in the decision tree below the most distinguishing features. <strong>If you don’t have time to read the full article, read this tree only and skip to </strong><a href="https://blog.sicara.com/compare-best-javascript-chart-libraries-2017-89fbe8cb112d#1072"><strong>the libraries links</strong></a><strong>. </strong>These features are based on the criteria reviewed in this article. Use it to choose the right javascript charting library for your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bR2-wCe4Zh3LbZrnScV7dg.png" /></figure><h4>Licenses info</h4><p><strong>Except for Highcharts, all these libraries are either under </strong><a href="https://opensource.org/licenses/MIT"><strong>MIT</strong></a><strong> or </strong><a href="https://www.apache.org/licenses/LICENSE-2.0"><strong>Apache</strong></a><strong> license</strong>. This means they can be used for <strong>free</strong>. For more details about these licenses you can read <a href="http://exygy.com/which-license-should-i-use-mit-vs-apache-vs-gpl/">this article</a>.</p><p>You can also use Highcharts for free for <a href="https://www.highcharts.com/products/highcharts"><strong>non commercial purposes</strong></a>. Otherwise you need to buy a license.</p><h4><strong>Github repositories activity and popularity</strong></h4><p>I asked the CTO of a data visualization company what was the first thing he checked to choose the right JS charting library. His answer was: the activity and popularity of the Github repository. This is important because it gives some guarantees that the library will be:</p><ul><li>maintained over time</li><li>enhanced with new features</li></ul><p>I summed up the important elements to look at in order to choose a library. I coloured the cells from good (green) to bad (red).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*em2umh7pgx3yv_QoCe1-Ow.png" /><figcaption>Github repositories statistics — Friday, 8th September 2017</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*96FOXssU8weV2WQpkHKiSQ.png" /><figcaption>Github repositories activities — Friday, 8th September 2017</figcaption></figure><p>Here is what we learn:</p><ul><li>Unsurprisingly, all of these libraries have overall good Github statistics. We can expect them to be maintained over time.</li><li>Highcharts and Plotly.js are under heavy developments since a few years. This means we can expect new features delivered regularly with both of these libraries. Chartist seems to be on a quiet period with very few commits on the last months.</li></ul><p><em>Keep in mind, this data will not be updated. I strongly encourages you to go check how it has evolved.</em></p><h4>Provided graphs and charts</h4><p>I reviewed the presence of 7 types of visualizations:</p><ul><li><strong>Basic:</strong> line, bar, column, scatter plot, bubble, donut / pie, and area charts</li><li><strong>Scientific:</strong> contour plot, heat map, ternary plot, polar graph, carpet plot, and parallel coordinates plot</li><li><strong>Financial:</strong> time series, candlesticks</li><li><strong>Statistical:</strong> error bars, box plots, 2D density plots, tree map</li><li><strong>3D:</strong> point cloud, line, ribbon, surface, and mesh plots</li><li><strong>Map: </strong>choropleth maps, scatter plot on maps, bubble maps, line on maps</li></ul><p>I know you can fit other charts on these six types. And I may have missed some other important visualizations. However, I believe that these types of graphs satisfy most of the projects needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8-EXtbCRs82PIJ_ledUEgQ.png" /></figure><p>What does not appear on the table above:</p><ul><li>Plotly and Highcharts provide many other chart types</li></ul><h4>Design and customization options</h4><p>Comparing design and customization options is tricky. Each library provides custom options and it is hard to compare them. I decided to make it simple and compare the presence of the following options:</p><ul><li>presence of <strong>zoom</strong> and <strong>tooltip</strong></li><li>possibility to add a <strong>title</strong> and a <strong>legend</strong></li><li><strong>responsiveness</strong> of the graphs</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TvjYpcdWW8x5Lb85PF8cVg.png" /></figure><p>Finally you can get a feel of the design of each library by browsing the examples below. Whenever possible I tried to mix a line chart with a bar chart. I also tried to include all the listed options above, whenever available.</p><p>If you are a developer, you might also want to take a look at the code. Code readability is not the first criteria to choose your chart visualization library. But it might help you choose between them if you are hesitating.</p><p>For non techies just click on <em>Result</em> :).</p><h3>Libraries links and code examples</h3><h4><a href="http://www.chartjs.org/">Chart.js</a></h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2Fjrkftuyr%2Fembedded%2F&amp;url=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2Fjrkftuyr%2F&amp;image=https%3A%2F%2Fwww.gravatar.com%2Favatar%2F8c12ed02af34d6fec43910749b38007e%2F%3Fdefault%3D%26s%3D80&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/816ddbc62203910a5f658bbcc9e0af9f/href">https://medium.com/media/816ddbc62203910a5f658bbcc9e0af9f/href</a></iframe><ul><li><a href="https://github.com/reactjs/react-chartjs">Chart.js for React</a></li><li><a href="https://github.com/valor-software/ng2-charts">Chart.js for Angular</a></li><li><a href="http://jtblin.github.io/angular-chart.js/">Chart.js for AngularJS</a></li><li><a href="https://github.com/apertureless/vue-chartjs">Chart.js for VueJS</a></li></ul><h4><a href="https://www.highcharts.com/">Highcharts</a></h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2F3h3dpx2b%2Fembedded%2F&amp;url=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2F3h3dpx2b%2F&amp;image=https%3A%2F%2Fwww.gravatar.com%2Favatar%2F8c12ed02af34d6fec43910749b38007e%2F%3Fdefault%3D%26s%3D80&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/26a98820d119eeb8354fcfcfc601cd47/href">https://medium.com/media/26a98820d119eeb8354fcfcfc601cd47/href</a></iframe><ul><li><a href="https://github.com/kirjs/react-highcharts">Highcharts for React</a></li><li><a href="https://github.com/gevgeny/angular2-highcharts">Highcharts for Angular</a></li><li><a href="https://github.com/pablojim/highcharts-ng">Highcharts for AngularJS</a></li><li><a href="https://github.com/weizhenye/vue-highcharts">Highcharts for VueJS</a></li></ul><h4><a href="http://c3js.org/">C3</a></h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2F9zc871dj%2Fembedded%2F&amp;url=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2F9zc871dj%2F&amp;image=https%3A%2F%2Fwww.gravatar.com%2Favatar%2F8c12ed02af34d6fec43910749b38007e%2F%3Fdefault%3D%26s%3D80&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/04d7fa217d988f4f8b97f6af1666be4a/href">https://medium.com/media/04d7fa217d988f4f8b97f6af1666be4a/href</a></iframe><ul><li><a href="https://github.com/bcbcarl/react-c3js">C3JS for React</a></li><li>There is no current library for C3JS on Angular but you can read <a href="https://groups.google.com/forum/#!topic/c3js/fT-yUSs1ros">this post on Google groups</a></li><li><a href="https://github.com/jettro/c3-angular-directive">C3JS for AngularJS</a></li><li><a href="https://github.com/chryb/vue-c3">C3JS for VueJS</a></li></ul><h4><a href="http://nvd3.org/">NVD3</a></h4><p>You cannot add titles, but you can use raw D3.js for that. There is no support for zooming as well.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2F2ucj4s3p%2Fembedded%2F&amp;url=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2F2ucj4s3p%2F&amp;image=https%3A%2F%2Fwww.gravatar.com%2Favatar%2F8c12ed02af34d6fec43910749b38007e%2F%3Fdefault%3D%26s%3D80&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/6efd634dd952fbdca3e13104c70e75ba/href">https://medium.com/media/6efd634dd952fbdca3e13104c70e75ba/href</a></iframe><ul><li><a href="https://github.com/NuCivic/react-nvd3">NVD3 for React</a></li><li><a href="https://github.com/krispo/ng2-nvd3">NVD3 for Angular</a></li><li><a href="https://github.com/krispo/angular-nvd3">NVD3 for AngularJS</a></li><li><a href="https://github.com/DotNetAge/vue-nvd3">NVD3 for VueJS (careful, it seems unmaintained)</a></li></ul><h4><a href="https://plot.ly/javascript/">Plotly.js</a></h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2Fgxjd0yvh%2Fembedded%2F&amp;url=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2Fgxjd0yvh%2F&amp;image=https%3A%2F%2Fwww.gravatar.com%2Favatar%2F8c12ed02af34d6fec43910749b38007e%2F%3Fdefault%3D%26s%3D80&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a22daad006454d4a39259b4a623258c/href">https://medium.com/media/8a22daad006454d4a39259b4a623258c/href</a></iframe><ul><li><a href="https://github.com/benjeffery/react-plotlyjs">Plotly.js for React</a></li><li>Plotly.js does not seem to work with Angular, you can <a href="https://github.com/plotly/plotly.js/issues/955">follow the Github issue here</a></li><li><a href="https://github.com/alonho/angular-plotly">Plotly.js for AngularJS</a></li><li>Plotly.js seems to work out of the box on Vue.js. You can see <a href="https://admin.vuebulma.com/#/charts/plotly">this demo</a> and the <a href="https://github.com/vue-bulma/vue-admin">corresponding Github project</a></li></ul><h4><a href="https://gionkunz.github.io/chartist-js/">Chartist</a></h4><p>No native support to add a title, zoom, tooltips or a legend. There are available <a href="https://gionkunz.github.io/chartist-js/plugins.html">plugins</a> that provide zooming and tooltips options. Unable to mix two types of charts.</p><p>Chartist provides special support to add custom animations.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2Fw4gnvjLu%2Fembedded%2F&amp;url=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2Fw4gnvjLu%2F&amp;image=https%3A%2F%2Fwww.gravatar.com%2Favatar%2F8c12ed02af34d6fec43910749b38007e%2F%3Fdefault%3D%26s%3D80&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa1133db8abc104bff1167d530408341/href">https://medium.com/media/aa1133db8abc104bff1167d530408341/href</a></iframe><ul><li><a href="https://github.com/fraserxu/react-chartist">Chartist for React</a></li><li><a href="https://github.com/willsoto/ng-chartist">Chartist for Angular</a></li><li><a href="https://github.com/willsoto/angular-chartist.js">Chartist for AngularJS</a></li><li><a href="https://github.com/Yopadd/vue-chartist">Chartist for VueJS</a></li></ul><h4><a href="http://formidable.com/open-source/victory/">Victory</a></h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2Fss4k6avv%2Fembedded%2F&amp;url=https%3A%2F%2Fjsfiddle.net%2Fadilbaaj%2Fss4k6avv%2F&amp;image=https%3A%2F%2Fwww.gravatar.com%2Favatar%2F8c12ed02af34d6fec43910749b38007e%2F%3Fdefault%3D%26s%3D80&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/77a68e172a8747552ecd449e3a49cb2f/href">https://medium.com/media/77a68e172a8747552ecd449e3a49cb2f/href</a></iframe><p>As said, Victory only works on React.</p><h3>Conclusion</h3><p>Some of you might be tempted to think: the more options and provided graphs the better. Then why not choose Plotly for all the projects since it offers the largest diversity of charts? This is not the right approach.<strong> If your needs are fulfilled by a simple lightweight library like Chartist, then go for it</strong>. Keep it simple. It will save you time by not diving into unnecessary options. Moreover your application would load faster with lighter dependencies. Once again it all depends on your project needs and how you think they will evolve. If you’re a warrior or if you have very specific needs, you can build your own custom charts and graphs using D3. Happy charting!</p><p><strong>Did you like this article? Don’t forget to hit the Follow button!</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F7b74b2%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F7b74b2%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/16025a82a71074d387b4467252c833a0/href">https://medium.com/media/16025a82a71074d387b4467252c833a0/href</a></iframe><p>Other articles you might be interested in :</p><p><a href="http://blog.theodo.fr/2017/12/clean-tests-react-intl-missing-message-errors-console/">Clean your Tests from React-Intl &quot;Missing message&quot; Errors in Console</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89fbe8cb112d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sicara/compare-best-javascript-chart-libraries-2017-89fbe8cb112d">Compare the Best Javascript Chart Libraries</a> was originally published in <a href="https://medium.com/sicara">Sicara&#39;s blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Set up D3.js Inside React in 5 Minutes]]></title>
            <link>https://medium.com/sicara/a-starting-point-on-using-d3-with-react-869fdf3dfaf?source=rss-2bd3ab99a5af------2</link>
            <guid isPermaLink="false">https://medium.com/p/869fdf3dfaf</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[3d]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Adil Baaj]]></dc:creator>
            <pubDate>Mon, 02 Jan 2017 08:59:56 GMT</pubDate>
            <atom:updated>2018-09-07T15:26:30.882Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*1Xk2adl7Zcjal-_dV2rtpQ.jpeg" /></figure><p>Using D3 with React is not as straightforward as you would expect. Here is how you can get around it.</p><h4><strong>The problem about using D3 with React</strong></h4><p>When creating a new D3 element, D3 modifies the DOM used by the browser. On the other hand, React uses a virtual DOM. For performance purposes, whenever React needs to update a component, it first modifies the virtual DOM, then it only re-renders on the real DOM the nodes that were actually modified.</p><p>Now the problem about using D3 with React is that if D3 modifies an element of the DOM, this modification won’t be reflected on the virtual DOM used by React. Then, if by any chance React needs to re-render a node of the real DOM that D3 has already modified, it can lead to bugs that can be hard to debug.</p><p>Run the Codepen below and try to:</p><p>• Modify the background color to red using the state<br>• Modify the background color to green accessing the DOM element with D3<br>• Modify the background color to red again using the state</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FAdilBaaj%2Fembed%2Fpreview%2FaBeqze%3Fheight%3D600%26slug-hash%3DaBeqze%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2FAdilBaaj%2Fpen%2FaBeqze%3Feditors%3D1111&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F997814.aBeqze.small.54041fdc-6b2c-4e15-b3e3-83a739367b90.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/349564b7115d026230edb97cda688743/href">https://medium.com/media/349564b7115d026230edb97cda688743/href</a></iframe><p>Wait but what? The third step fails? The reason is React doesn’t expect another library to modify the DOM.</p><p>So how can we safely use D3 with React?</p><h4>D3 with React and react-faux-dom</h4><p>In this tutorial we will use <a href="https://github.com/Olical/react-faux-dom">react-faux-dom</a>. This library allows to create a fake DOM, to manipulate it with D3, and then to transform it into a React component. One of the benefits of using this library is to be able to use the full D3 API without changing the original syntax while respecting React’s approach: using a virtual DOM to render elements. So basically you could just copy some code using D3, paste it into a React component using react-faux-dom and it should work.</p><p>However the first time I used react-faux-dom to render this <a href="http://bl.ocks.org/mbostock/3885304">frequency chart</a> nothing rendered. So I wanted to share with you these two mistakes to avoid if you want to use react-faux-dom:</p><p>The first way to use react-faux-dom is to use <em>React.createClass</em> with react-faux-dom core mixin. In this case make sure to have a default value set for <em>this.state.chart</em>, otherwise your component won’t render:</p><p><em>You can find the full code for the following examples </em><a href="https://github.com/AdilBaaj/react-faux-dom-D3"><em>here</em></a><em>.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3bad40896bc41f05b0a24bc796e338b8/href">https://medium.com/media/3bad40896bc41f05b0a24bc796e338b8/href</a></iframe><p>If you prefer ES6 React component you can’t use react-faux-dom core mixin, as explained <a href="https://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#mixins">here</a>. In this case you need to use <em>createElement </em>method<em> </em>followed by <em>toReact</em>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac4f604b554aff50179c7461bf1f96f7/href">https://medium.com/media/ac4f604b554aff50179c7461bf1f96f7/href</a></iframe><p>Finally you could also render your code directly in the render function using <em>React.createClass</em>. But as written in a comment by the author of react-faux-dom in this <a href="http://oli.me.uk/2015/09/09/d3-within-react-the-right-way/">post</a>, putting your code outside of the render function is supposed to perform better.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fad4edcb016a92ad6165f883422857fd/href">https://medium.com/media/fad4edcb016a92ad6165f883422857fd/href</a></iframe><h4>Conclusion</h4><p>There is no perfect way to use React with D3, and using react-faux-dom is a good solution if you want to stay “React compliant”. If you want to know more about how you can safely use D3 with React you can read this very well written <a href="https://mikewilliamson.wordpress.com/2016/06/03/d3-and-react-3-ways/">post</a> of Mike Williamson.</p><p><strong>Did you like this article? Don’t forget to hit the Follow button!</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F7b74b2%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F7b74b2%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/16025a82a71074d387b4467252c833a0/href">https://medium.com/media/16025a82a71074d387b4467252c833a0/href</a></iframe><p>Other articles you might be interested in :</p><p><a href="http://blog.theodo.fr/2017/12/clean-tests-react-intl-missing-message-errors-console/">Clean your Tests from React-Intl &quot;Missing message&quot; Errors in Console</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=869fdf3dfaf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sicara/a-starting-point-on-using-d3-with-react-869fdf3dfaf">Set up D3.js Inside React in 5 Minutes</a> was originally published in <a href="https://medium.com/sicara">Sicara&#39;s blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>