Archive for category Graphing

A brand new version of eDigitizer with improved functions

Since the eDigitizer 2.0 released in a couple of year ago, new functions were requested and fulfilled. Some minor bugs were fixed. Now it is time to announce that a brand new version 2.10 is released. The new version brings the following new functions to the application.

  1. The linear distance of each segment is calculated and added together. This is the total distance between the first and last points. When you save the digitized data to file, you automatically get the points and the distances.
  2. Draw markers and line segments between adjacent points. That will help user to keep track of what is digitized and how good he does the job.

The following functions are either fixed or enhanced.

  1. The image can be restored by clicking the restore button. After the image is restored to its original, all line segments and point markers on the image will disappear.
  2. When you load a new image, all digitized information (data) will be cleaned. So make sure to save your digitized data before you do that.
  3. Save image function will save the image plus the point markers and line segments. So be careful that you do not overwrite the original image.
  4. During the digitizing period and after axes are digitized, you should not switch between two different size modes. if you do, the digitized data will be messed up.

The new version need .Net 2.0 and above framework to run. It can be used in Windows XP, Windows Vista, and Windows 7 etc.

To get the new release, just simply download the zip file and unpacked files into a folder; double click the eDigitizer application file; you can run the application right way.

Here is a snapshot for you to view.

Download the new release: eDigitizer210



Tags: , , , , , ,

Display stock charts on your own website

Plain stock chart
In searching an easy way to display stock charts on a web page hosted in a web server, two useful scripts were found on the internet:

1. Easy Yahoo stock chart ASP.NET Page
2. Displaying a daily chart for a ticker symbol

Even the scripts were written in different languages, they use a common idea that fetch the Yahoo stock charts and display them locally. The first article gives a basic framework to do this in PHP. It has one missing statements at the beginning of the script. I added that and use the Yahoo link from the second article. Now this script can show 6 months and 3 months and daily chart at once.

//stock chart shower
//Beginners PHP
//Description : This allows a user to enter a ticker symbol
//and rather than the usual dry quotes displays a chart of
//how the stock has performed over the whole year


if ($symbol =="")
<form action='<?php print $PHP_SELF; ?>' method ='post'>
Enter your ticker symbol :<input type='text' name='symbol' size = 6><br>
<input type='submit' value="show chart">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="image/gif; charset=iso-8859-1">
<img border="0" src="<?php print $symbol; ?>&t=6m&q=c&l=on&z=l&a=v&p=s">
<img border="0" src="<?php print $symbol; ?>&t=3m&q=c&l=on&z=m&a=v&p=s">
<img border="0" src="<?php print $symbol; ?>">


Flash Stock Chart

Open Flash Chart 2 provides a whole library of PHP, PERL, Python, .NET and more languages that help your generate SWF flash charts for free. On its website, there are tons of examples to help you use the library. OFC2 uses JSON as the file format and you can generate cool chart in very short time.

The PHP source code to get data from database and generate JSON file for SWF chart is listed here.


include_once 'php-ofc-library/open-flash-chart.php';
include_once '../';

$stock_tick = 'LIWA';

$sql = " SELECT price_open, price_high, price_low, price_close, stock_volume, c_year, c_month, c_day from stockdata s ".
" INNER JOIN company c ON s.id_company=c.id_company ".
" INNER JOIN caldate d ON s.id_caldate=d.id_caldate ".
" WHERE c.tick='$stock_tick' ".
" ORDER BY c_year ASC, c_month ASC, c_day ASC ".
" ; ";
$result = mysql_query($sql);

if (!$result) {
die('Invalid query: ' . mysql_error());

$data = array();
$volume = array();
$max = 0;
while($row = mysql_fetch_array($result))
// LOOK: PHP thinks our data is text,
//       force it to be an integer:
$data[] = new candle_value(

$volume[] = (float)$row['stock_volume'];


$title = new title( $stock_tick );

### Candle graph for stock price
$candle = new candle('#9933CC');
$candle->set_tooltip('#x_label#<br>High: #high#<br>Open: #open#<br>Close: #close#<br>Low: #low#');
//$candle->set_on_show(new bar_on_show('drop', .9, 0));

$y = new y_axis();
$y->set_range( 0, 11, 0);

$chart = new open_flash_chart();
$chart->set_title( $title );
$chart->add_element( $candle );
$chart->set_y_axis( $y );

### bar graph for stock volume
$bar = new bar();
$bar->set_values( $volume );
$bar->axis = 'right';

$yr = new y_axis_right();
$yr->set_range( 0, 2000000, 0);

$chart->add_element( $bar );
$chart->set_y_axis_right( $yr );

#echo $chart->toPrettyString();

function write2file($str,$filename)
$fh = fopen($filename, 'w') or die("can't open file");
fwrite($fh, $str);


The HTML file that used to show the SWF chart is listed below.


<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">

"open-flash-chart.swf", "my_price_chart",
"1000", "400", "9.0.0", "expressInstall.swf",
{"data-file":"LIWA_price.json"} );



<h1>Hello world!</h1>
<div id="my_price_chart"></div>
<div id="my_volume_chart"></div>

For details to use OFC2 and the above codes, please go to OFC2 website and read more details.

Weekly Chart from StockCharts
StockCharts provides nice stock charts with some useful information. A strategy similar to get charts from Yahoo site can be adopted. The link to point to stock chart looks like There is a problem when you directly embed the link to your website. It suggests you visit their site to view the chart instead of just show it. To solve the problem, we can download the stock charts locally and save them to PNG files. Then the charts can be used as local images. To do that, we can use Linux wget command.

wget “” -O arst.png


Tags: , , , , ,

Gene network visualization

Cytoscape is an open source bioinformatics software platform for visualizing molecular interaction networks and biological pathways and integrating these networks with annotations, gene expression profiles and other state data. The following is a snapshot of the sowtware interface.


The current version of the software is v2.6.3. The core features of Cytoscape include data integration, visualization, and analysis. There are a lot of third party developed plugins freely available, too. Plugins are categorized in several groups: analysis, network and attribute I/O, network inference, functional enrichment, communication/scripting and others. If you have ideas to produce plugins for Cytoscape, Cytoscape provides plugin APIs for this purpose.


Tags: , ,

eDigitizer user guide

As a researcher, you may encounter the following situations from time to time. You need to get original data for a graph published in a scientific paper. The simple way is to use a ruler and estimate the value of each data point by eye. If you want to get the data more accurately, you have to turn to digitization software. Back to 2002, I wrote a MATLAB program that can do the job. Unfortunately, you have to own a copy of MATLAB to use the program. As inquiries increase recently, the eDigitizer is implemented in the .NET environment. There is no MATLAB required. Now the brand new implementation can run under Windows with .Net framework version 2 installed. In addition. The following lists it main features.

  1. Zoom and rotate images
  2. Test the orthogonality of axes
  3. Digitize axes
  4. Digitize data points
  5. Save digitized data to a text file

Get eDigitizer

Visit to download a copy of the application. This is a green software. You do not need to install it. Just expand the downloaded zip file to a folder and click the executable file – edigitizer-net2.exe. Since it need Microsoft .NET framework 2.0 runtime library, you have to install .Net framework 2.0 runtime redistribution package from the Microsoft web site.

Launch eDigitizer

First launch eDigitizer by double clicking it. You have to find the program in your hard disk by using Windows explorer or similar applications. Figure 1 shows the main window of the eDigitizer.

Figure 1

There are two functional area in eDigitizer’s main window. On the left side is a fixed area that houses all function commands. First functional block is related to image processing, such as load, zoom, rotate, restore and save image. The second functional block is related to digitizing X and Y axes and testing perpendicularity of them. The last functional block includes functions to digitize series. You can digitize as many series as you want. All data will be stored in text file. On the right side includes a zooming area with multiple tabs, image tab, graph tab and data tab. It takes the major portion of the main window. The size of this area changes with the eDigitizer window. If you move the mouse cursor to this area, the cursor changes to a big blue cross. That can help users to locate points on the screen. Before you load any image to the system, these tab areas have nothing. Next step is loading image.

Load image

Loading an image is pretty simple. Just click “Browse” button on the top of left panel and an “Open an image” dialog window will pop up (Figure 2). You can navigate to the folder where images are stored and select one to open.

Figure 2

Once the selected image is loaded, the main window looks like Figure 3.

Figure 3

Digitize axes and test perpendicularity

Now you can directly click “Test” button in the Axes frame to test the orthogonality of the axes. Move the mouse cursor to the graph and it changes to the big blue cross. You have to sample three points (the origin, one point on X axis and one point on Y axis in sequence, Figure 4) in the coordinates.

Figure 4

Click the origin, one point on X axis and one point on Y Axis sequentially, and then you will see the Theta (θ) and Alpha (α) values in the Axes frame of the left panel (refer to Figure 3). Figure 5 shows the definition of the two angles. If the alpha value is less than 1 degree and theta is around 90 degree. The orthogonality of the axes is good. You can directly digitize data points without rotation of the image. Otherwise, you have to rotate the image based on the alpha value you got in this step.

Figure 5

Next step is digitizing X and Y axes. Click X or Y button in Axes frame. The two textboxes below the buttons will change to “Name/Unit” and “Values”. What you need to do is enter the variable name and unit of X or Y axes in the first textbox and enter a comma separate values based on you actual situation into the second textbox. For the sample image we see in Figure 3, we have the following:

X axis: Name/Unit: Time (Hour); Values: -12, 0, 12, 24, 36, 48, 60, 72
Y axis: Name/Unit: mRNA; Values: 0, 0.5, 1.0

After you enter the pair for X axis, you should click “Collect” button to digitize the points in X axis. You have to digitize the points in the same order as you enter them in the Values textbox. The application will know when you finish the digitization based on the number of values you entered in the Values textbox. Once all points are digitized, there will be linear equation with R2 value shown up just above the “Collect” button. For this situation, the intercept of the linear equation is -21.55 and the slope is 0.24 with a R2 of 1.0 (See Figure 6)

Figure 6

You can follow the same step to digitize the three points on Y axis.

Digitize series

Now we are ready to digitize our first series. Let’s pick “wt(col)” line to demonstrate the process.

  1. Enter “wt(col)” in the Name textbox in the Series frame
  2. Click “Collect” button
  3. Move cursor to image and it will change to a big blue cross
  4. Move the big blue cross to the center of the first open square on the left of the image and click it
  5. Move the big blue cross to the next open square and click it, repeat this step until you complete the last open square on the right side of the image
  6. Click “Commit” button in the Series frame. Note: before digitizing, this button is called “Collect”.
  7. Switch to “Graph” tab, you can see the digitized series like Figure 7
  8. Switch to “Data” tab, you can see the digitized data like Figure 8

Figure 7

Figure 8

Congratulations! You have completed your first digitization. You can click “Save” button in the Series frame to save your results to a file for late use. Is it simple? Yes, it is pretty simple. You can digitize as many series of you want and save them into one text file.



Tags: , , , , ,

Frequency histogram 制作频率分布图



其中Data_array为一数组或对一组数值的引用,用来计算频率。如果 data_array 中不包含任何数值,函数FREQUENCY返回零数组。Bins_array为一数组或对数组区域的引用,设定对data_array进行频率计算的分段点。如果bins_array中不包含任何数值,函数FREQUENCY返回data_array元素的数目。





1)EXCEL提供了一个数据分析包(Analysis toolpak),打开该分析包的方法是使用ADD-INS菜单命令。
2)使用菜单命令Tools|Data Analysis…,在弹出菜单中选中”Random Number Generation”,完成对话框中的相应输入框,在A2:A101单元格中生成100个随机数字。
10)制作频率分布图:选中D5:E17,做一个连线图(Line),单击’Series’标签,在’Category(X) axis labels’中选中C5:C17,等图形完成后,选中实际数据线,单击鼠标右键,在弹出的右键菜单中选中’Chart type’,将其设置成柱状图(Cloumn),并设置间隙为0;并格式化Normal数据为平滑曲线。


Tags: , , ,