Is there a recommended vizualisation for this kind of data:

Company x switched from MySQL to Postgres
Company y switched from mongodb to tidb
Company z switched from mongodb to MySQL

I don’t care about visualizing companies, the only thing that matters is to represent the switches (ie: more company have switched from MySQL to mongodb than from Postgres to tidb).

Not sure my question is clear enough, that’s my first question here, let me know if I can improve it!

  • 1
    $\begingroup$ A sankey diagram might be what you're looking for. $\endgroup$
    – Oxbowerce
    Jul 29, 2021 at 8:56

3 Answers 3


You may consider this problem as Graph and chart its WeightedAdjacencyMatrix. I am using Wolfram Language but the same steps apply to your choice of language.

I'll create some example data from a recent survey of top 10 popular DBMS.

dbs = {{"Oracle", 1271}, {"MySQL", 1228}, {"Microsoft SQL Server", 991},
       {"PostgreSQL", 569}, {"MongoDB", 488}, {"IBM Db2", 167}, 
       {"Redis", 165}, {"Elasticsearch", 155}, {"SQLite", 131}, 
       {"Microsoft Access", 115}};

wd = WeightedData[Sequence @@ Transpose[dbs]];

 , ChartLabels -> {None, wd["InputData"]}
 , BarOrigin -> Left
 , PlotTheme -> "Detailed"

Mathematica graphics

Then generate 200 pairs of from-to moves using the survey's EmpiricalDistribution inside of WeightedData.

moves = RandomChoice[wd, {200, 2}];

Collect the Counts of the pairs.

counts = Counts[moves];
<|{MySQL,SQLite}->2,{Elasticsearch,SQLite}->1,<<52>>,{Microsoft SQL Server,Redis}->1,{IBM Db2,MongoDB}->1|>

Create indices for the DBMS names.

With[{n = wd["InputData"]}
 , vertex = Thread[n -> Range@Length@n]
{Oracle->1,MySQL->2,Microsoft SQL Server->3,<<4>>,Elasticsearch->8,SQLite->9,Microsoft Access->10}

Create a SparseArray adjacency matrix from counts using the vertex for indices.

adjMatrix = SparseArray[Normal@counts /. vertex, ConstantArray[Length@vertex, 2]];
adjMatrix // MatrixForm

Mathematica graphics

MatrixPlot the matrix.

ticks = List @@@ Reverse[vertex, {2}];
 SparseArray[Normal@counts /. vertex]
 , FrameTicks -> {
   , MapAt[Rotate[#, π/2] &, ticks, {All, -1}]
 , PlotLegends -> Automatic
 , Mesh -> All
 , MeshStyle -> LightGray

Mathematica graphics

The graph can also be charted from counts with Thickness and Opacity a function of the EdgeWeight.

edgeStyle =
  (Rule @@@ Keys[counts] /. vertex ) ->
    Directive[Opacity@#, Thickness@#2] &
    , Transpose[{
        Rescale[#, MinMax@#, {.25, 1}]
        , Rescale[#, MinMax@#, {.002, .005}]
        } &@Values[counts]
    , {1}

graph = Graph[
  Rule @@@ Keys[counts] /. vertex
  , VertexLabels -> Reverse[vertex, {2}]
  , EdgeWeight -> Values[counts]
  , EdgeStyle -> edgeStyle
  , GraphLayout -> "CircularEmbedding"

Mathematica graphics

Hope this helps.


You could go for a heat map, whose rows and columns would be the software from and software to, respectively and the values are the number of users that switched from one to another.

This might look like this:

enter image description here


Add a new column to your dataset. set the value of the column to 0 if "MySQL to MongoDB" or 1 if "Postgres to tidb".

Then create a bar chart based on the new column. And mention what is 0 and what is 1 in the legend.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.