1
$\begingroup$

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!

$\endgroup$
1
2
$\begingroup$

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]];

BarChart[
 wd["Weights"]
 , 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.

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

Collect the Counts of the pairs.

counts = Counts[moves];
Short@counts
<|{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]
 ];
Short@vertex
{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}];
MatrixPlot[
 SparseArray[Normal@counts /. vertex]
 , FrameTicks -> {
   ticks
   , 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 =
 Thread[
  (Rule @@@ Keys[counts] /. vertex ) ->
   Apply[
    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.

$\endgroup$
1
$\begingroup$

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

$\endgroup$
0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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